From adb19b32d52bd914b8a14f0304adddbca1f0335f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Wed, 30 Jun 1999 18:39:13 -0700 Subject: [PATCH] fixed a potentially serious thread bug Rev: src/threads.c:1.101 --- src/threads.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/threads.c b/src/threads.c index 76e0535596..d1863486f4 100644 --- a/src/threads.c +++ b/src/threads.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: threads.c,v 1.100 1999/06/19 20:18:43 hubbe Exp $"); +RCSID("$Id: threads.c,v 1.101 1999/07/01 01:39:13 hubbe Exp $"); int num_threads = 1; int threads_disabled = 0; @@ -746,6 +746,11 @@ void f_mutex_lock(INT32 args) if(m->key) { + if(threads_disabled) + { + free_object(o); + error("Cannot wait for mutexes when threads are disabled!\n"); + } SWAP_OUT_CURRENT_THREAD(); do { @@ -900,6 +905,9 @@ void f_cond_wait(INT32 args) mut=OB2KEY(key)->mut; if(!mut) error("Bad argument 1 to condition->wait()\n"); + if(threads_disabled) + error("Cannot wait for conditions when threads are disabled!\n"); + /* Unlock mutex */ mut->key=0; OB2KEY(key)->mut=0; -- GitLab