Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmxmlrpc / xmlrpc_pthreads.h
blob31d4049a1ba429747d427bf2179248dc79dd6266
1 /* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
2 **
3 ** Redistribution and use in source and binary forms, with or without
4 ** modification, are permitted provided that the following conditions
5 ** are met:
6 ** 1. Redistributions of source code must retain the above copyright
7 ** notice, this list of conditions and the following disclaimer.
8 ** 2. Redistributions in binary form must reproduce the above copyright
9 ** notice, this list of conditions and the following disclaimer in the
10 ** documentation and/or other materials provided with the distribution.
11 ** 3. The name of the author may not be used to endorse or promote products
12 ** derived from this software without specific prior written permission.
13 **
14 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 ** SUCH DAMAGE. */
26 #ifndef xmlrpc_pthreads_h_
27 #define xmlrpc_pthreads_h_
29 #if !defined(HAVE_PTHREADS)
30 # error This system does not have PThreads
31 #endif
33 #ifndef WIN32
34 # define _REENTRANT
35 # include <pthread.h>
36 #elif defined (WIN32)
37 /*typedef PVOID HANDLE; */
38 typedef HANDLE pthread_t;
39 typedef CRITICAL_SECTION pthread_mutex_t;
41 #define PTHREAD_MUTEX_INITIALIZER NULL
42 //usage: pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
44 typedef
45 struct
47 int attrs; //currently unused. placeholder.
48 } pthread_attr_t;
50 typedef
51 struct
53 int attrs; //currently unused. placeholder.
54 } pthread_mutexattr_t;
56 //typedef void * (*pthread_func)(void *);
57 typedef unsigned ( __stdcall *pthread_func )( void * );
59 extern int pthread_create(pthread_t *new_thread_ID,
60 const pthread_attr_t *attr,
61 pthread_func start_func, void *arg);
62 extern int pthread_cancel(pthread_t target_thread);
63 extern int pthread_join(pthread_t target_thread, void **status);
64 extern int pthread_detach(pthread_t target_thread);
66 extern int pthread_mutex_init(pthread_mutex_t *mp,
67 const pthread_mutexattr_t *attr);
68 extern int pthread_mutex_lock(pthread_mutex_t *mp);
69 extern int pthread_mutex_unlock(pthread_mutex_t *mp);
70 extern int pthread_mutex_destroy(pthread_mutex_t *mp);
72 #endif
74 #endif