Back to index

citadel  8.12
threads.h
Go to the documentation of this file.
00001 
00002 #ifndef THREADS_H
00003 #define THREADS_H
00004 
00005 #include "sysdep.h"
00006 
00007 #ifdef HAVE_PTHREAD_H
00008 #include <pthread.h>
00009 #endif
00010 
00011 #include <sys/time.h>
00012 #include <string.h>
00013 
00014 #ifdef HAVE_DB_H
00015 #include <db.h>
00016 #elif defined(HAVE_DB4_DB_H)
00017 #include <db4/db.h>
00018 #else
00019 #error Neither <db.h> nor <db4/db.h> was found by configure. Install db4-devel.
00020 #endif
00021 
00022 #include "server.h"
00023 #include "sysdep_decls.h"
00024 
00025 /*
00026  * Things we need to keep track of per-thread instead of per-session
00027  */
00028 struct thread_tsd {
00029        DB_TXN *tid;            /* Transaction handle */
00030        DBC *cursors[MAXCDB];   /* Cursors, for traversals... */
00031 };
00032 
00033 extern struct thread_tsd masterTSD;
00034 #define TSD MyThread()
00035 
00036 extern int num_workers;
00037 extern int active_workers;
00038 extern int server_shutting_down;
00039 
00040 struct thread_tsd *MyThread(void);
00041 int try_critical_section (int which_one);
00042 void begin_critical_section (int which_one);
00043 void end_critical_section (int which_one);
00044 void go_threading(void);
00045 void InitializeMasterTSD(void);
00046 void CtdlThreadCreate(void *(*start_routine)(void*));
00047 
00048 #endif // THREADS_H