blob: cca27328a986239f6cd2197634d9e896cb71ecd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2012 Microsoft Corporation. All Rights Reserved.
//
// Module Name:
// HelperFunctions_ThreadsAndEvents.cpp
//
// Abstract:
// This module contains prototypes for functions which simplify threads and eventing.
//
// Exported Functions:
//
// Internal Functions:
//
// Author:
// Dusty Harper (DHarper)
//
// Revision History:
//
// [ Month ][Day] [Year] - [Revision]-[ Comments ]
// May 01, 2010 - 1.0 - Creation
//
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef HELPERFUNCTIONS_THREADS_AND_EVENTS_H
#define HELPERFUNCTIONS_THREADS_AND_EVENTS_H
typedef struct THREAD_DATA_
{
LPTHREAD_START_ROUTINE threadStartRoutine;
UINT32 threadId;
HANDLE thread;
HANDLE threadStartEvent;
HANDLE threadStopEvent;
HANDLE threadContinueEvent;
}THREAD_DATA, *PTHREAD_DATA;
VOID HlprEventReset(_In_opt_ HANDLE event);
VOID HlprEventSet(_In_opt_ HANDLE event);
_Success_(return == NO_ERROR)
UINT32 HlprThreadStart(_Inout_ THREAD_DATA* pThreadData,
_In_opt_ VOID* pData = 0);
_Success_(return == NO_ERROR)
UINT32 HlprThreadStop(_Inout_ THREAD_DATA* pThreadData);
_At_(*ppThreadData, _Pre_ _Notnull_)
_When_(return != NO_ERROR, _At_(*ppThreadData, _Post_ _Notnull_))
_When_(return == NO_ERROR, _At_(*ppThreadData, _Post_ _Null_))
_Success_(return == NO_ERROR && *ppThreadData == 0)
UINT32 HlprThreadStop(_Inout_ THREAD_DATA** ppThreadData);
VOID HlprThreadCleanup(_Inout_opt_ THREAD_DATA* pThreadData);
_Success_(return == NO_ERROR)
UINT32 HlprThreadWaitForCompletion(_Inout_opt_ THREAD_DATA* pThreadData);
_Success_(return == NO_ERROR)
UINT32 HlprThreadWaitForEvent(_In_ HANDLE eventHandle,
_In_ THREAD_DATA* pThreadData);
#endif /// HELPERFUNCTIONS_THREADS_AND_EVENTS_H
|