------------------------------------------------------------------------ r5777 | davew | 2007-11-25 17:15:18 -0500 (Sun, 25 Nov 2007) | 34 lines Changed paths: M /trunk/citadel/citserver.c M /trunk/citadel/database.h M /trunk/citadel/database_sleepycat.c M /trunk/citadel/housekeeping.c M /trunk/citadel/include/ctdl_module.h M /trunk/citadel/mk_module_init.sh M /trunk/citadel/modules/autocompletion/serv_autocompletion.c M /trunk/citadel/modules/bio/serv_bio.c M /trunk/citadel/modules/calendar/serv_calendar.c M /trunk/citadel/modules/chat/serv_chat.c A /trunk/citadel/modules/checkpoint A /trunk/citadel/modules/checkpoint/serv_checkpoint.c M /trunk/citadel/modules/expire/serv_expire.c M /trunk/citadel/modules/fulltext/serv_fulltext.c M /trunk/citadel/modules/funambol/serv_funambol.c M /trunk/citadel/modules/imap/serv_imap.c M /trunk/citadel/modules/inetcfg/serv_inetcfg.c M /trunk/citadel/modules/ldap/serv_ldap.c M /trunk/citadel/modules/listsub/serv_listsub.c M /trunk/citadel/modules/managesieve/serv_managesieve.c M /trunk/citadel/modules/mrtg/serv_mrtg.c M /trunk/citadel/modules/netfilter/serv_netfilter.c M /trunk/citadel/modules/network/serv_network.c M /trunk/citadel/modules/newuser/serv_newuser.c M /trunk/citadel/modules/notes/serv_notes.c M /trunk/citadel/modules/pager/serv_pager.c M /trunk/citadel/modules/pas2/serv_pas2.c M /trunk/citadel/modules/pop3/serv_pop3.c M /trunk/citadel/modules/pop3client/serv_pop3client.c M /trunk/citadel/modules/rssclient/serv_rssclient.c M /trunk/citadel/modules/rwho/serv_rwho.c M /trunk/citadel/modules/sieve/serv_sieve.c M /trunk/citadel/modules/smtp/serv_smtp.c M /trunk/citadel/modules/spam/serv_spam.c M /trunk/citadel/modules/test/serv_test.c M /trunk/citadel/modules/upgrade/serv_upgrade.c M /trunk/citadel/modules/vandelay/serv_vandelay.c M /trunk/citadel/modules/vcard/serv_vcard.c M /trunk/citadel/serv_extensions.c M /trunk/citadel/serv_extensions.h M /trunk/citadel/server_main.c M /trunk/citadel/sysconfig.h M /trunk/citadel/sysdep.c M /trunk/citadel/sysdep_decls.h
Here it is, the new thread interface. The code to handle threads is in sysdep.c This new thread interface has caused a change to the way modules are initialised. A modules init function is now called twice. First time threading==0, second time threading==1. threading is a parameter passed to the init function. You should not create a thread until your init function has been called with threading==1. See serv_fulltext.c as an example. All of the modules init functions have been updated for this change. The old RegisterThread stuff has gone away. time_to_die has gone as it was used to tell threads to exit, we now use CtdlThreadCheckStop() instead which return non zero if the thread should exit. The server will exit when all threads have stopped. CtdlThreadCreate() handles creation of threads in a safe manner. CtdlThreadSleep() is used to do a sleep in a thread. CtdlThreadStop() is used to stop a thread. CtdlThreadStopAll() stops all threads and thus causes the server to exit. Threads are cleanup when they die by the main server process (every 10 seconds) which originally did nothing useful. CtdlThreadGC() will force a garbage collection now. CtdlThreadGetCount() return the number of threads in the system not just the number of workers. CtdlThreadSelf() returns a pointer to this threads thread structure. CtdlThreadName() returns a strdup'd string that is the threads name, you need to free this. It also allows you to change a threads name. CtdlThreadCancel() does the same as pthread_cancel except it also informs our thread system. Don't use this if you can help it. There are a lot of debug messages at the moment, they will go away once stability is proven. ------------------------------------------------------------------------