X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fsysdep.c;h=655bb7249286fc26975c3acd563f76b0dbb5e663;hb=fe4a9ff9d1b33197fb5dfc45567b98c63049d7b6;hp=3a011d641ce44f015900e6021981288fbd010c3f;hpb=2b24cf7cab39cf13c5fb3073db2f954c53d5dd61;p=citadel.git diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 3a011d641..655bb7249 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -264,6 +264,9 @@ void init_sysdep(void) { void begin_critical_section(int which_one) { /* lprintf(9, "begin_critical_section(%d)\n", which_one); */ + /* ensure nobody ever tries to do a critical section within a + transaction; this could lead to deadlock. */ + cdb_check_handles(); pthread_mutex_lock(&Critters[which_one]); } @@ -459,7 +462,6 @@ void client_write(char *buf, int nbytes) } while (bytes_written < nbytes) { - signal(SIGPIPE, SIG_IGN); retval = write(sock, &buf[bytes_written], nbytes - bytes_written); if (retval < 1) { @@ -1144,7 +1146,7 @@ void *worker_thread(void *arg) { /* make doubly sure we're not holding any stale db handles * which might cause a deadlock. */ - cdb_release_handles(); + cdb_check_handles(); begin_critical_section(S_I_WANNA_SELECT); SETUP_FD: memcpy(&readfds, &masterfds, sizeof masterfds); @@ -1284,7 +1286,7 @@ SETUP_FD: memcpy(&readfds, &masterfds, sizeof masterfds); dead_session_purge(); if ((time(NULL) - last_timer) > 60L) { last_timer = time(NULL); - cdb_release_handles(); /* suggested by Justin Case */ + cdb_check_handles(); /* suggested by Justin Case */ PerformSessionHooks(EVT_TIMER); }