]> code.citadel.org Git - citadel.git/blobdiff - citadel/include/ctdl_module.h
Created a routine to get a copy of the context list so that it can be
[citadel.git] / citadel / include / ctdl_module.h
index dd8d96ca5720893bf4f3f59e75732d6e78019fa8..5dc418131b0aa86d392ddf61e4b2e3beda91c8cc 100644 (file)
@@ -6,7 +6,7 @@
 #include "server.h"
 #include "sysdep_decls.h"
 #include "msgbase.h"
-
+#include "threads.h"
 /*
  * define macros for module init stuff
  */
@@ -117,7 +117,7 @@ struct CtdlThreadNode *CtdlThreadSchedule(char *name, long flags, void *(*thread
 void CtdlThreadSleep(int secs);
 void CtdlThreadStop(struct CtdlThreadNode *thread);
 int CtdlThreadCheckStop(void);
-void CtdlThreadCancel(struct CtdlThreadNode *thread);
+/* void CtdlThreadCancel2(struct CtdlThreadNode *thread); Leave this out, it should never be needed */
 const char *CtdlThreadName(const char *name);
 struct CtdlThreadNode *CtdlThreadSelf(void);
 int CtdlThreadGetCount(void);
@@ -129,11 +129,24 @@ void CtdlThreadStopAll(void);
 int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
 void CtdlThreadAllocTSD(void);
 
+#define CTDLTHREAD_BIGSTACK    0x0001
+#define CTDLTHREAD_WORKER      0x0002
+
 /* Macros to speed up getting outr thread */
 
 #define MYCURSORS      (((ThreadTSD*)pthread_getspecific(ThreadKey))->cursors)
 #define MYTID          (((ThreadTSD*)pthread_getspecific(ThreadKey))->tid)
 #define CT             (((ThreadTSD*)pthread_getspecific(ThreadKey))->self)
 
+/** return the current context list as an array and do it in a safe manner
+ * The returned data is a copy so only reading is useful
+ * The number of contexts is returned in count.
+ * Beware, this does not copy any of the data pointed to by the context.
+ * This means that you can not rely on things like the redirect buffer being valid.
+ * You must free the returned pointer when done.
+ */
+struct CitContext *CtdlGetContextArray (int *count);
+
+
 
 #endif /* CTDL_MODULE_H */