grammar updates
[mono.git] / mono / io-layer / timed-thread.h
1 /*
2  * timed-thread.h:  Implementation of timed thread joining
3  *
4  * Author:
5  *      Dick Porter (dick@ximian.com)
6  *
7  * (C) 2002 Ximian, Inc.
8  */
9
10 #ifndef _WAPI_TIMED_THREAD_H_
11 #define _WAPI_TIMED_THREAD_H_
12
13 #include <config.h>
14 #include <glib.h>
15 #include <pthread.h>
16 #ifdef HAVE_SEMAPHORE_H
17 #include <semaphore.h>
18 #endif
19
20 #include "mono-mutex.h"
21
22 typedef struct
23 {
24         pthread_t id;
25         mono_mutex_t join_mutex;
26         pthread_cond_t exit_cond;
27         guint32 create_flags;
28         int suspend_count;
29         sem_t suspend_sem, suspended_sem;
30         guint32 (*start_routine)(gpointer arg);
31         void (*exit_routine)(guint32 exitstatus, gpointer userdata);
32         gpointer arg;
33         gpointer exit_userdata;
34         guint32 exitstatus;
35         gboolean exiting;
36         gpointer stack_ptr;
37 } TimedThread;
38
39 extern void _wapi_timed_thread_exit(guint32 exitstatus) G_GNUC_NORETURN;
40 extern int _wapi_timed_thread_create(TimedThread **threadp,
41                                      const pthread_attr_t *attr,
42                                      guint32 create_flags,
43                                      guint32 (*start_routine)(gpointer),
44                                      void (*exit_routine)(guint32, gpointer),
45                                      gpointer arg, gpointer exit_userdata);
46 extern int _wapi_timed_thread_attach(TimedThread **threadp,
47                                      void (*exit_routine)(guint32, gpointer),
48                                      gpointer exit_userdata);
49 extern int _wapi_timed_thread_join(TimedThread *thread,
50                                    struct timespec *timeout,
51                                    guint32 *exitstatus);
52 extern void _wapi_timed_thread_destroy (TimedThread *thread);
53 extern void _wapi_timed_thread_suspend (TimedThread *thread);
54 extern void _wapi_timed_thread_resume (TimedThread *thread);
55
56 #endif /* _WAPI_TIMED_THREAD_H_ */