| OLD | NEW |
| 1 // Copyright 2009 The RE2 Authors. All Rights Reserved. | 1 // Copyright 2009 The RE2 Authors. All Rights Reserved. |
| 2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
| 3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RE2_UTIL_THREAD_H__ | 5 #ifndef RE2_UTIL_THREAD_H__ |
| 6 #define RE2_UTIL_THREAD_H__ | 6 #define RE2_UTIL_THREAD_H__ |
| 7 | 7 |
| 8 #ifdef _WIN32 | |
| 9 #include <windows.h> | |
| 10 #else | |
| 11 #include <pthread.h> | 8 #include <pthread.h> |
| 12 #endif | |
| 13 | 9 |
| 14 class Thread { | 10 class Thread { |
| 15 public: | 11 public: |
| 16 Thread(); | 12 Thread(); |
| 17 virtual ~Thread(); | 13 virtual ~Thread(); |
| 18 void Start(); | 14 void Start(); |
| 19 void Join(); | 15 void Join(); |
| 20 void SetJoinable(bool); | 16 void SetJoinable(bool); |
| 21 virtual void Run() = 0; | 17 virtual void Run() = 0; |
| 22 | 18 |
| 23 private: | 19 private: |
| 24 #ifdef _WIN32 | |
| 25 HANDLE pid_; | |
| 26 #else | |
| 27 pthread_t pid_; | 20 pthread_t pid_; |
| 28 #endif | |
| 29 bool running_; | 21 bool running_; |
| 30 bool joinable_; | 22 bool joinable_; |
| 31 }; | 23 }; |
| 32 | 24 |
| 33 #endif // RE2_UTIL_THREAD_H__ | 25 #endif // RE2_UTIL_THREAD_H__ |
| 26 |
| OLD | NEW |