]> code.citadel.org Git - citadel.git/blobdiff - citadel/include/ctdl_module.h
Changed the way we do the TSD area.
[citadel.git] / citadel / include / ctdl_module.h
index c83555c8fcab15b29b55e7a34f1c4e77c5e17bc6..b0508a96bf80482b7e79b444c2249fe9df630493 100644 (file)
 
 #define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init (threading)
 
+#define CTDL_MODULE_UPGRADE(module_name) char *ctdl_module_##module_name##_upgrade (void)
+
+#define CTDL_UPGRADE_CALL(module_name) ctdl_module_##module_name##_upgrade ()
+
 
 /*
  * Prototype for making log entries in Citadel.
@@ -38,8 +42,8 @@ void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
 void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
 void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
 
-void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
-void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
+void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
+void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
 
 void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
                                                        int EventType);
@@ -111,33 +115,24 @@ void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *er
 struct CtdlThreadNode *CtdlThreadCreate(char *name, long flags, void *(*thread_func) (void *arg), void *args);
 void CtdlThreadSleep(int secs);
 void CtdlThreadStop(struct CtdlThreadNode *thread);
-int CtdlThreadCheckStop(struct CtdlThreadNode *this_thread);
+int CtdlThreadCheckStop(void);
 void CtdlThreadCancel(struct CtdlThreadNode *thread);
-char *CtdlThreadName(struct CtdlThreadNode *thread, char *name);
+const char *CtdlThreadName(const char *name);
 struct CtdlThreadNode *CtdlThreadSelf(void);
 int CtdlThreadGetCount(void);
 int CtdlThreadGetWorkers(void);
+double CtdlThreadGetWorkerAvg(void);
+double CtdlThreadGetLoadAvg(void);
 void CtdlThreadGC(void);
 void CtdlThreadStopAll(void);
-int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, struct CtdlThreadNode *self);
+int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout, struct CtdlThreadNode *self);
+void CtdlThreadAllocTSD(void);
 
 /* Macros to speed up getting outr thread */
-#define CT _this_cit_thread
-#define CT_PUSH() \
-       struct CtdlThreadNode *_this_cit_thread;\
-       _this_cit_thread = CtdlThreadSelf()
-
-
-#ifdef WITH_THREADLOG
-#define CtdlThreadPushName(NAME) \
-       char *_push_name; \
-       _push_name = CtdlThreadName(CtdlThreadSelf(), NAME)
-
-#define CtdlThreadPopName() \
-       free (CtdlThreadName(CtdlThreadSelf(), _push_name))
-#else
-#define CtdlThreadPushName(NAME)
-#define CtdlThreadPopName()
-#endif
+
+#define MYCURSORS      (((ThreadTSD*)pthread_getspecific(ThreadKey))->cursors)
+#define MYTID          (((ThreadTSD*)pthread_getspecific(ThreadKey))->tid)
+#define CT             (((ThreadTSD*)pthread_getspecific(ThreadKey))->self)
+
 
 #endif /* CTDL_MODULE_H */