OpenZWave Library  1.4.3493
windows/ThreadImpl.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // ThreadImpl.h
4 //
5 // Windows implementation of a cross-platform thread
6 //
7 // Copyright (c) 2010 Mal Lansell <mal@lansell.org>
8 // All rights reserved.
9 //
10 // SOFTWARE NOTICE AND LICENSE
11 //
12 // This file is part of OpenZWave.
13 //
14 // OpenZWave is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU Lesser General Public License as published
16 // by the Free Software Foundation, either version 3 of the License,
17 // or (at your option) any later version.
18 //
19 // OpenZWave is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU Lesser General Public License for more details.
23 //
24 // You should have received a copy of the GNU Lesser General Public License
25 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
26 //
27 //-----------------------------------------------------------------------------
28 #ifndef _ThreadImpl_H
29 #define _ThreadImpl_H
30 
31 #include <string>
32 #include <windows.h>
33 #include "platform/Thread.h"
34 
35 namespace OpenZWave
36 {
37  class Thread;
38  class Event;
39 
42  class ThreadImpl
43  {
44  private:
45  friend class Thread;
46 
47  ThreadImpl( Thread* _owner, string const& _name );
48  ~ThreadImpl();
49 
50  bool Start( Thread::pfnThreadProc_t _pfnThreadProc, Event* _exitEvent, void* _context );
51  void Sleep( uint32 _milliseconds );
52  bool Terminate();
53 
54  bool IsSignalled();
55 
56  void Run();
57  static DWORD WINAPI ThreadProc( void* _pArg );
58 
59  Thread* m_owner;
60  HANDLE m_hThread;
61  Event* m_exitEvent;
62  Thread::pfnThreadProc_t m_pfnThreadProc;
63  void* m_context;
64  bool m_bIsRunning;
65  string m_name;
66  };
67 
68 } // namespace OpenZWave
69 
70 #endif //_ThreadImpl_H
71 
Definition: Bitfield.h:34
Platform-independent definition of event objects.
Definition: Event.h:39
Implements a platform-independent thread management class.
Definition: Thread.h:42
void(* pfnThreadProc_t)(Event *_exitEvent, void *_context)
Definition: Thread.h:45
unsigned int uint32
Definition: Defs.h:80
Windows-specific implementation of the Thread class.
Definition: windows/ThreadImpl.h:42