Skip to content
Snippets Groups Projects
Commit 6e1db5b2 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added some black magic to init_threads_disable().

Rev: src/threads.c:1.74
parent 283361af
No related branches found
No related tags found
No related merge requests found
#include "global.h" #include "global.h"
RCSID("$Id: threads.c,v 1.73 1998/07/05 13:51:50 grubba Exp $"); RCSID("$Id: threads.c,v 1.74 1998/07/09 21:50:37 grubba Exp $");
int num_threads = 1; int num_threads = 1;
int threads_disabled = 0; int threads_disabled = 0;
...@@ -174,7 +174,22 @@ void exit_threads_disable(struct object *o) ...@@ -174,7 +174,22 @@ void exit_threads_disable(struct object *o)
void init_threads_disable(struct object *o) void init_threads_disable(struct object *o)
{ {
threads_disabled++; /* Serious black magic to avoid dead-locks */
if (!threads_disabled) {
extern MUTEX_T password_protection_mutex;
THREADS_ALLOW_UID();
mt_lock(&password_protection_mutex);
THREADS_DISALLOW_UID();
threads_disabled = 1;
mt_unlock(&password_protection_mutex);
} else {
threads_disabled++;
}
THREADS_FPRINTF((stderr, "init_threads_disable(): threads_disabled:%d\n", THREADS_FPRINTF((stderr, "init_threads_disable(): threads_disabled:%d\n",
threads_disabled)); threads_disabled));
while (live_threads) { while (live_threads) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment