initial load of upstream version 1.06.32
[xmlrpc-c] / lib / abyss / src / thread.h
1 #ifndef THREAD_H_INCLUDED
2 #define THREAD_H_INCLUDED
3
4 /*********************************************************************
5 ** Thread
6 *********************************************************************/
7
8 typedef struct abyss_thread TThread;
9
10 void
11 ThreadPoolInit(void);
12
13 typedef void TThreadProc(void * const userHandleP);
14 typedef void TThreadDoneFn(void * const userHandleP);
15
16 void
17 ThreadCreate(TThread **      const threadPP,
18              void *          const userHandle,
19              TThreadProc   * const func,
20              TThreadDoneFn * const threadDone,
21              abyss_bool      const useSigchld,
22              const char **   const errorP);
23
24 abyss_bool
25 ThreadRun(TThread * const threadP);
26
27 abyss_bool
28 ThreadStop(TThread * const threadP);
29
30 abyss_bool
31 ThreadKill(TThread * threadP);
32
33 void
34 ThreadWaitAndRelease(TThread * const threadP);
35
36 void
37 ThreadExit(int const retValue);
38
39 void
40 ThreadRelease(TThread * const threadP);
41
42 abyss_bool
43 ThreadForks(void);
44
45 void
46 ThreadUpdateStatus(TThread * const threadP);
47
48 #ifndef WIN32
49 void
50 ThreadHandleSigchld(pid_t const pid);
51 #endif
52
53 /*********************************************************************
54 ** Mutex
55 *********************************************************************/
56
57 #ifdef WIN32
58 typedef HANDLE TMutex;
59 #else
60 #include <pthread.h>
61 typedef pthread_mutex_t TMutex;
62 #endif  /* WIN32 */
63
64 abyss_bool MutexCreate(TMutex *m);
65 abyss_bool MutexLock(TMutex *m);
66 abyss_bool MutexUnlock(TMutex *m);
67 abyss_bool MutexTryLock(TMutex *m);
68 void MutexFree(TMutex *m);
69
70 #endif