]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/threads.c
CtdlForEachMessage() don't process message 0
[citadel.git] / citadel / server / threads.c
index 6b782a673d684d5e8fb4c5719dbd7342c4dc1273..7fe9d5f38b9d7e98bbeaa088e9b74be2e27e1373 100644 (file)
@@ -21,7 +21,6 @@ int active_workers = 0;                               // Number of ACTIVE worker threads
 pthread_mutex_t Critters[MAX_SEMAPHORES];      // Things needing locking
 int server_shutting_down = 0;                  // set to nonzero during shutdown
 pthread_mutex_t ThreadCountMutex;
-char locks[MAX_SEMAPHORES+1];
 
 void InitializeSemaphores(void) {
        int i;
@@ -29,9 +28,7 @@ void InitializeSemaphores(void) {
        // Set up a bunch of semaphores to be used for critical sections
        for (i=0; i<MAX_SEMAPHORES; ++i) {
                pthread_mutex_init(&Critters[i], NULL);
-               locks[i] = ' ';
        }
-       locks[MAX_SEMAPHORES] = 0;
 }
 
 
@@ -54,25 +51,16 @@ void begin_critical_section(int which_one) {
        // For all types of critical sections except those listed here,
        // ensure nobody ever tries to do a critical section within a
        // transaction; this could lead to deadlock.
-       if (    (which_one != S_FLOORCACHE)
-               && (which_one != S_NETCONFIGS)
-       ) {
+       if ((which_one != S_FLOORCACHE) && (which_one != S_NETCONFIGS)) {
                cdb_check_handles();
        }
 
-       //syslog(LOG_ERR, "\033[3%dm  lock(%14p, %2d, %s)\033[0m", (which_one%6)+1, pthread_self(), which_one, locks);
        pthread_mutex_lock(&Critters[which_one]);
-       //if (locks[which_one] != 'X') {
-               //syslog(LOG_ERR, "\033[31mThread %p had to wait to get a lock on %d\033[0m", pthread_self(), which_one);
-       //}
-       locks[which_one] = 'X';
 }
 
 
 // Release a semaphore lock to end a critical section.
 void end_critical_section(int which_one) {
-       locks[which_one] = '_';
-       //syslog(LOG_ERR, "\033[3%dmunlock(%14p, %2d, %s)\033[0m", (which_one%6)+1, pthread_self(), which_one, locks);
        pthread_mutex_unlock(&Critters[which_one]);
 }