Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/Thread.h

Issue 29367003: Issue #4711 - Rewrite legacy thread facilities
Patch Set: Created Dec. 7, 2016, 4:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH
4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef ADBLOCKPLUS_THREAD_H
19 #define ADBLOCKPLUS_THREAD_H
20
21 #ifdef WIN32
22 #include <windows.h>
23 #else
24 #include <pthread.h>
25 #endif
26
27 namespace AdblockPlus
28 {
29 void Sleep(const int millis);
30
31 class Mutex
Eric 2016/12/07 18:06:25 Class was unused except in tests.
32 {
33 public:
34 #ifdef WIN32
35 CRITICAL_SECTION nativeMutex;
36 #else
37 pthread_mutex_t nativeMutex;
38 #endif
39
40 Mutex();
41 ~Mutex();
42 void Lock();
43 void Unlock();
44 };
45
46 class Lock
Eric 2016/12/07 18:06:25 Class was unused except in tests.
47 {
48 public:
49 Lock(Mutex& mutex);
50 ~Lock();
51
52 private:
53 Mutex& mutex;
54 };
55
56 class Thread
57 {
58 public:
59 explicit Thread(bool deleteSelfOnFinish = false);
60 virtual ~Thread();
61 virtual void Run() = 0;
62 void Start();
63 void Join();
Eric 2016/12/07 18:06:25 Function was unused except in tests.
64 private:
65 static void CallRun(Thread* thread);
66 private:
67 #ifdef WIN32
68 HANDLE nativeThread;
69 #else
70 pthread_t nativeThread;
71 #endif
72 bool m_deleteSelfOnFinish;
73 };
74 }
75
76 #endif
OLDNEW
« src/Scheduler.cpp ('K') | « src/Scheduler.cpp ('k') | src/Thread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld