OpenZWave Library 1.4.0
Loading...
Searching...
No Matches
winRT/ThreadImpl.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2//
3// ThreadImpl.h
4//
5// WinRT implementation of a cross-platform thread
6//
7// Copyright (c) 2015 Microsoft Corporation
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#include <ppltasks.h>
35
36namespace OpenZWave
37{
38 class Thread;
39 class Event;
40
43 class ThreadImpl
44 {
45 private:
46 friend class Thread;
47
48 ThreadImpl( Thread* _owner, string const& _name );
49 ~ThreadImpl();
50
51 bool Start( Thread::pfnThreadProc_t _pfnThreadProc, Event* _exitEvent, void* _context );
52 void Sleep( uint32 _milliseconds );
53 bool Terminate();
54
55 bool IsSignalled();
56
57 void Run();
58 static DWORD WINAPI ThreadProc( void* _pArg );
59
60 Thread* m_owner;
61 Event* m_exitEvent;
62 Thread::pfnThreadProc_t m_pfnThreadProc;
63 void* m_context;
64 bool m_bIsRunning;
65 string m_name;
66
67 static int32 s_threadTerminateTimeout;
68 };
69
70} // namespace OpenZWave
71
72#endif //_ThreadImpl_H
73
unsigned int uint32
Definition Defs.h:80
signed int int32
Definition Defs.h:79
Platform-independent definition of event objects.
Definition Event.h:40
Windows-specific implementation of the Thread class.
Definition windows/ThreadImpl.h:43
friend class Thread
Definition windows/ThreadImpl.h:45
Implements a platform-independent thread management class.
Definition Thread.h:43
void(* pfnThreadProc_t)(Event *_exitEvent, void *_context)
Definition Thread.h:45
Definition Bitfield.h:35