Annotation of win32/apache13/src/include/multithread.h, revision 1.1.1.1
1.1 parser 1: #ifndef APACHE_MULTITHREAD_H
2: #define APACHE_MULTITHREAD_H
3:
4: #ifdef __cplusplus
5: extern "C" {
6: #endif
7:
8: #define MULTI_OK (0)
9: #define MULTI_TIMEOUT (1)
10: #define MULTI_ERR (2)
11:
12: typedef void mutex;
13: typedef void semaphore;
14: typedef void thread;
15: typedef void event;
16:
17: /*
18: * Ambarish: Need to do the right stuff on multi-threaded unix
19: * I believe this is terribly ugly
20: */
21: #ifdef MULTITHREAD
22: #ifdef NETWARE
23: #define APACHE_TLS
24: #else
25: #define APACHE_TLS __declspec( thread )
26: #endif
27:
28: thread *create_thread(void (thread_fn) (void *thread_arg), void *thread_arg);
29: int kill_thread(thread *thread_id);
30: int await_thread(thread *thread_id, int sec_to_wait);
31: void exit_thread(int status);
32: void free_thread(thread *thread_id);
33:
34: API_EXPORT(mutex *) ap_create_mutex(char *name);
35: API_EXPORT(mutex *) ap_open_mutex(char *name);
36: API_EXPORT(int) ap_acquire_mutex(mutex *mutex_id);
37: API_EXPORT(int) ap_release_mutex(mutex *mutex_id);
38: API_EXPORT(void) ap_destroy_mutex(mutex *mutex_id);
39:
40: semaphore *create_semaphore(int initial);
41: int acquire_semaphore(semaphore *semaphore_id);
42: int release_semaphore(semaphore *semaphore_id);
43: void destroy_semaphore(semaphore *semaphore_id);
44:
45: event *create_event(int manual, int initial, char *name);
46: event *open_event(char *name);
47: int acquire_event(event *event_id);
48: int set_event(event *event_id);
49: int reset_event(event *event_id);
50: void destroy_event(event *event_id);
51:
52: #else /* ndef MULTITHREAD */
53:
54: #define APACHE_TLS
55: /* Only define the ones actually used, for now */
56: extern void *ap_dummy_mutex;
57:
58: #define ap_create_mutex(name) ((mutex *)ap_dummy_mutex)
59: #define ap_acquire_mutex(mutex_id) ((int)MULTI_OK)
60: #define ap_release_mutex(mutex_id) ((int)MULTI_OK)
61: #define ap_destroy_mutex(mutex_id)
62:
63: #endif /* ndef MULTITHREAD */
64:
65: #ifdef __cplusplus
66: }
67: #endif
68:
69: #endif /* !APACHE_MULTITHREAD_H */
E-mail: