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
master
Xavier Leroy 1997-09-04 13:46:50 +00:00
parent 0efc0065fc
commit 86efb275c5
3 changed files with 10 additions and 9 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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;
}