summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1997-09-04 13:46:50 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1997-09-04 13:46:50 +0000
commit86efb275c52103190fcba5a1a6899d39f7031e83 (patch)
tree5d34c6db530e243cad0f80148fd7717a6de09f7f
parent0efc0065fc1c1f1709ffd9abeee1751409c2170a (diff)
Makefiles: enlever /Zi. win32.c: utiliser WaitForMultipleObjects pour condition_wait
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1702 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--otherlibs/systhreads/Makefile.nt2
-rw-r--r--otherlibs/systhreads/Tests/Makefile.nt2
-rw-r--r--otherlibs/systhreads/win32.c15
3 files changed, 10 insertions, 9 deletions
diff --git a/otherlibs/systhreads/Makefile.nt b/otherlibs/systhreads/Makefile.nt
index 4f631088f..7cd4ae0cd 100644
--- a/otherlibs/systhreads/Makefile.nt
+++ b/otherlibs/systhreads/Makefile.nt
@@ -21,7 +21,7 @@ libthreads.lib: $(BYTECODE_C_OBJS)
$(MKLIB)libthreads.lib $(BYTECODE_C_OBJS)
win32_b.obj: win32.c
- $(BYTECC) -O -I..\..\byterun $(BYTECCCOMPOPTS) /Zi -c win32.c
+ $(BYTECC) -O -I..\..\byterun $(BYTECCCOMPOPTS) -c win32.c
mv win32.obj win32_b.obj
libthreadsnat.lib: $(NATIVECODE_C_OBJS)
diff --git a/otherlibs/systhreads/Tests/Makefile.nt b/otherlibs/systhreads/Tests/Makefile.nt
index 485eaf7e1..4b7945373 100644
--- a/otherlibs/systhreads/Tests/Makefile.nt
+++ b/otherlibs/systhreads/Tests/Makefile.nt
@@ -4,7 +4,7 @@ PROGS=test1.byt test2.byt test3.byt test4.byt test5.byt test6.byt \
!include ../../../config/Makefile.nt
-CAMLC=..\..\..\boot\ocamlrun ..\..\..\ocamlc -I .. -I ..\..\win32unix -I ..\..\..\stdlib -ccopt /Zi
+CAMLC=..\..\..\boot\ocamlrun ..\..\..\ocamlc -I .. -I ..\..\win32unix -I ..\..\..\stdlib
CAMLOPT=..\..\..\boot\ocamlrun ..\..\..\ocamlopt -I .. -I ..\..\win32unix -I ..\..\..\stdlib
all: $(PROGS)
diff --git a/otherlibs/systhreads/win32.c b/otherlibs/systhreads/win32.c
index 4a4321663..1017c601d 100644
--- a/otherlibs/systhreads/win32.c
+++ b/otherlibs/systhreads/win32.c
@@ -522,21 +522,22 @@ value caml_condition_new(value unit) /* ML */
value caml_condition_wait(value cond, value mut) /* ML */
{
- int retcode1, retcode2;
+ int retcode;
HANDLE m = Mutex_val(mut);
HANDLE s = Condition_val(cond)->sem;
+ HANDLE handles[2];
Condition_val(cond)->count ++;
enter_blocking_section();
/* Release mutex */
ReleaseMutex(m);
- /* Wait for semaphore to be non-null, and decrement it */
- retcode1 = WaitForSingleObject(s, INFINITE);
- /* Re-acquire mutex */
- retcode2 = WaitForSingleObject(m, INFINITE);
+ /* Wait for semaphore to be non-null, and decrement it.
+ Simultaneously, re-acquire mutex. */
+ handles[0] = s;
+ handles[1] = m;
+ retcode = WaitForMultipleObjects(2, handles, TRUE, INFINITE);
leave_blocking_section();
- if (retcode1 == WAIT_FAILED || retcode2 == WAIT_FAILED)
- caml_wthread_error("Condition.wait");
+ if (retcode == WAIT_FAILED) caml_wthread_error("Condition.wait");
return Val_unit;
}