]> code.citadel.org Git - citadel.git/blobdiff - citadel/include/ctdl_module.h
Added --with-threadlog. Use this if you want the thread table written to
[citadel.git] / citadel / include / ctdl_module.h
index 5d8764db436878461b570a806d6f343bd41570a1..e979830e8506da47b2903ff33170a1070786e702 100644 (file)
@@ -5,14 +5,32 @@
 
 #include "server.h"
 #include "sysdep_decls.h"
+#include "msgbase.h"
 
 /*
  * define macros for module init stuff
  */
  
-#define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (void)
+#define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (int threading)
 
-#define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init ()
+#define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init (threading)
+
+
+/*
+ * Prototype for making log entries in Citadel.
+ */
+
+void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...);
+
+/*
+ * Fix the interface to aide_message so that it complies with the Coding style
+ */
+#define CtdlAideMessage(TEXT, SUBJECT) aide_message(TEXT, SUBJECT)
+
+/*
+ * Hook functions available to modules.
+ */
 
 void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
 void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
@@ -86,4 +104,30 @@ int CtdlDoDirectoryServiceFunc(char *cn, char *ou, void **object, char *module,
  */
 void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response);
 
+
+/*
+ * Citadel Threads API
+ */
+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(void);
+void CtdlThreadCancel(struct CtdlThreadNode *thread);
+char *CtdlThreadName(struct CtdlThreadNode *thread, char *name);
+struct CtdlThreadNode *CtdlThreadSelf(void);
+int CtdlThreadGetCount(void);
+void CtdlThreadGC(void);
+void CtdlThreadStopAll(void);
+#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
+
 #endif /* CTDL_MODULE_H */