Commit fab815a6 authored by John van Groningen's avatar John van Groningen

in function get_integers_from_thread_message after calling MsgWaitForMultipleObjects,

repeat only PeekMessage calls until it succeeds (don't repeat MsgWaitForMultipleObjects)
parent 1752df46
......@@ -76,8 +76,8 @@ int start_compiler_process (CleanString compiler_path,CleanString compiler_direc
if (r!=0){
*compiler_thread_id_p=pi.dwThreadId;
*compiler_thread_handle_p=pi.hThread;
*compiler_process_handle_p=pi.hProcess;
*compiler_thread_handle_p=(size_t)pi.hThread;
*compiler_process_handle_p=(size_t)pi.hProcess;
} else {
*compiler_thread_id_p=0;
*compiler_thread_handle_p=0;
......@@ -113,8 +113,8 @@ int get_integers_from_thread_message (int wm_number,size_t thread_handle,int *i1
int r;
r=PeekMessage (&message,INVALID_HANDLE_VALUE,wm_number,wm_number,PM_NOREMOVE | (QS_POSTMESSAGE<<16));
while (r==0){
r=MsgWaitForMultipleObjects (1,&thread_handle,0,INFINITE,QS_POSTMESSAGE);
if (r==0){
r=MsgWaitForMultipleObjects (1,(HANDLE*)&thread_handle,0,INFINITE,QS_POSTMESSAGE);
if (r==-1 || r==WAIT_OBJECT_0 || r==WAIT_ABANDONED_0){
*i1_p=0;
......@@ -122,7 +122,9 @@ int get_integers_from_thread_message (int wm_number,size_t thread_handle,int *i1
return 0;
}
r=PeekMessage (&message,INVALID_HANDLE_VALUE,wm_number,wm_number,PM_NOREMOVE | (QS_POSTMESSAGE<<16));
do {
r=PeekMessage (&message,INVALID_HANDLE_VALUE,wm_number,wm_number,PM_NOREMOVE | (QS_POSTMESSAGE<<16));
} while (r==0);
}
r=PeekMessage (&message,INVALID_HANDLE_VALUE,wm_number,wm_number,PM_REMOVE | (QS_POSTMESSAGE<<16));
......@@ -176,7 +178,7 @@ int send_string_to_thread (int thread_id,size_t process_handle,int wm_number,Cle
if (l==0 || chars[l-1]!='\0')
return 0;
file_map=CreateFileMapping ((HANDLE)(-1),NULL,PAGE_READWRITE,0,l,NULL);
file_map=CreateFileMapping (INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,l,NULL);
if (file_map==NULL)
return 0;
......
......@@ -21,9 +21,9 @@ get_current_thread_id = code {
start_compiler_process :: !String !String !String -> (!Int,!Int,!Int,!Int);
start_compiler_process a0 a1 a2 = code {
ccall start_compiler_process "SSS:IIII"
ccall start_compiler_process "SSS:IIpp"
};
// int start_compiler_process (CleanString compiler_path,CleanString compiler_directory,CleanString command,int* compiler_thread_id_p,int* compiler_thread_handle_p,int* process_handle_p);
// int start_compiler_process (CleanString compiler_path,CleanString compiler_directory,CleanString command,int* compiler_thread_id_p,size_t* compiler_thread_handle_p,size_t* process_handle_p);
send_string_to_thread :: !Int !Int !Int !String -> Int;
send_string_to_thread a0 a1 a2 a3 = code {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment