Do not check for DB_H definition anymore.
[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 extern struct thread_tsd masterTSD;
28 #define TSD MyThread()
29
30 extern int num_workers;
31 extern int active_workers;
32 extern int server_shutting_down;
33
34 struct thread_tsd *MyThread(void);
35 int try_critical_section (int which_one);
36 void begin_critical_section (int which_one);
37 void end_critical_section (int which_one);
38 void go_threading(void);
39 void InitializeMasterTSD(void);
40 void CtdlThreadCreate(void *(*start_routine)(void*));
41
42
43 extern pthread_mutex_t ThreadCountMutex;;
44
45 #endif // THREADS_H