OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FWL_THREAD_H | 7 #ifndef FWL_THREAD_H_ |
8 #define _FWL_THREAD_H | 8 #define FWL_THREAD_H_ |
| 9 |
9 class IFWL_NoteDriver; | 10 class IFWL_NoteDriver; |
10 class IFWL_Thread; | 11 |
11 class IFWL_NoteThread; | |
12 typedef struct _FWL_HTHREAD { void* pData; } * FWL_HTHREAD; | 12 typedef struct _FWL_HTHREAD { void* pData; } * FWL_HTHREAD; |
| 13 |
13 class IFWL_Thread { | 14 class IFWL_Thread { |
14 public: | 15 public: |
15 static IFWL_Thread* Create(); | 16 virtual void Release() = 0; |
| 17 virtual FWL_ERR Run(FWL_HTHREAD hThread) = 0; |
16 | 18 |
17 protected: | 19 protected: |
18 virtual ~IFWL_Thread() {} | 20 virtual ~IFWL_Thread() {} |
| 21 }; |
19 | 22 |
20 public: | |
21 virtual void Release() = 0; | |
22 virtual FWL_ERR Run(FWL_HTHREAD hThread) = 0; | |
23 }; | |
24 FWL_HTHREAD FWL_StartThread(IFWL_Thread* pThread, FX_BOOL bSuspended = FALSE); | |
25 FWL_ERR FWL_ResumeThread(FWL_HTHREAD hThread); | |
26 FWL_ERR FWL_SuspendThread(FWL_HTHREAD hThread); | |
27 FWL_ERR FWL_KillThread(FWL_HTHREAD hThread, int32_t iExitCode); | |
28 FWL_ERR FWL_StopThread(FWL_HTHREAD hThread, int32_t iExitCode); | |
29 FWL_ERR FWL_Sleep(FX_DWORD dwMilliseconds); | |
30 class IFWL_NoteThread : public IFWL_Thread { | 23 class IFWL_NoteThread : public IFWL_Thread { |
31 public: | 24 public: |
32 static IFWL_NoteThread* Create(); | |
33 virtual FWL_ERR Run(FWL_HTHREAD hThread) = 0; | |
34 virtual IFWL_NoteDriver* GetNoteDriver() = 0; | 25 virtual IFWL_NoteDriver* GetNoteDriver() = 0; |
35 }; | 26 }; |
36 typedef struct _FWL_HMUTEX { void* pData; } * FWL_HMUTEX; | 27 |
37 FWL_HMUTEX FWL_CreateMutex(); | 28 #endif // FWL_THREAD_H_ |
38 FWL_ERR FWL_DestroyMutex(FWL_HMUTEX hMutex); | |
39 FWL_ERR FWL_LockMutex(FWL_HMUTEX hMutex); | |
40 FWL_ERR FWL_TryLockMutex(FWL_HMUTEX hMutex); | |
41 FWL_ERR FWL_UnlockMutex(FWL_HMUTEX hMutex); | |
42 FWL_ERR FWL_IsLockedMutex(FWL_HMUTEX hMutex, FX_BOOL& bLocked); | |
43 typedef struct _FWL_HSEMAPHORE { void* pData; } * FWL_HSEMAPHORE; | |
44 FWL_HSEMAPHORE FWL_CreateSemaphore(); | |
45 FWL_ERR FWL_DestroySemaphore(FWL_HSEMAPHORE hSemaphore); | |
46 FWL_ERR FWL_WaitSemaphore(FWL_HSEMAPHORE hSemaphore); | |
47 FWL_ERR FWL_PostSemaphore(FWL_HSEMAPHORE hSemaphore, int32_t down = 1); | |
48 FWL_ERR FWL_GetSemaphoreValue(FWL_HSEMAPHORE hSemaphore, int32_t& value); | |
49 FWL_ERR FWL_ResetSemaphore(FWL_HSEMAPHORE hSemaphore, int32_t init); | |
50 #endif | |
OLD | NEW |