97eb996956acab4112b7a23a3cf5ea50e12547d9
[platform/upstream/freerdp.git] / winpr / libwinpr / thread / thread.h
1 /**
2  * WinPR: Windows Portable Runtime
3  * Process Thread Functions
4  *
5  * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  * Copyright 2015 Hewlett-Packard Development Company, L.P.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #ifndef WINPR_THREAD_PRIVATE_H
22 #define WINPR_THREAD_PRIVATE_H
23
24 #ifndef _WIN32
25
26 #include <pthread.h>
27
28 #include <winpr/thread.h>
29
30 #include "../handle/handle.h"
31
32 typedef void* (*pthread_start_routine)(void*);
33
34 struct winpr_thread
35 {
36         WINPR_HANDLE_DEF();
37
38         BOOL started;
39         int pipe_fd[2];
40         BOOL mainProcess;
41         BOOL detached;
42         BOOL joined;
43         BOOL exited;
44         DWORD dwExitCode;
45         pthread_t thread;
46         SIZE_T dwStackSize;
47         LPVOID lpParameter;
48         pthread_mutex_t mutex;
49         pthread_mutex_t threadIsReadyMutex;
50         pthread_cond_t threadIsReady;
51         LPTHREAD_START_ROUTINE lpStartAddress;
52         LPSECURITY_ATTRIBUTES lpThreadAttributes;
53 #if defined(WITH_DEBUG_THREADS)
54         void* create_stack;
55         void* exit_stack;
56 #endif
57 };
58 typedef struct winpr_thread WINPR_THREAD;
59
60 struct winpr_process
61 {
62         WINPR_HANDLE_DEF();
63
64         pid_t pid;
65         int status;
66         DWORD dwExitCode;
67 };
68 typedef struct winpr_process WINPR_PROCESS;
69
70 #endif
71
72 #endif /* WINPR_THREAD_PRIVATE_H */