Mailing list header changes (fuck you Google)
[citadel.git] / citadel / threads.h
1
2 #ifndef THREADS_H
3 #define THREADS_H
4
5 #include "sysdep.h"
6
7 #ifdef HAVE_PTHREAD_H
8 #include <pthread.h>
9 #endif
10
11 #include <sys/time.h>
12 #include <string.h>
13
14 #include <db.h>
15
16 #include "server.h"
17 #include "sysdep_decls.h"
18
19 /*
20  * Things we need to keep track of per-thread instead of per-session
21  */
22 struct thread_tsd {
23         DB_TXN *tid;            /* Transaction handle */
24         DBC *cursors[MAXCDB];   /* Cursors, for traversals... */
25 };
26
27 pthread_key_t ThreadKey;
28 extern struct thread_tsd masterTSD;
29 #define TSD MyThread()
30
31 extern int num_workers;
32 extern int active_workers;
33 extern int server_shutting_down;
34
35 struct thread_tsd *MyThread(void);
36 int try_critical_section (int which_one);
37 void begin_critical_section (int which_one);
38 void end_critical_section (int which_one);
39 void go_threading(void);
40 void InitializeMasterTSD(void);
41 void CtdlThreadCreate(void *(*start_routine)(void*));
42
43
44 extern pthread_mutex_t ThreadCountMutex;;
45
46 #endif // THREADS_H