The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on September 19, 2009, 09:58:36 AM

Title: WaitForSingleObject
Post by: ragdog on September 19, 2009, 09:58:36 AM
Hi

I have a little problem if i paused my Thread
and exit my app crash this!
The Tread works fine with pause and resume only not by call the Cleanup proc

Information to the Cleanup proc:
1.if Thread paused resume the Thread
2.wait if the Thread finish with WaitForSingleObject
3.end the dialog



@@:
.elseif uMsg == WM_CLOSE
             invoke MessageBox,hWnd,CTEXT ("Are you sure?"), CTEXT ("Question..."), MB_ICONQUESTION + MB_YESNO
             .if eax== IDNO
                jmp @B
             .endif
    .endif
    call CleanUp
         invoke  EndDialog,hWnd,0
  .else
         mov  eax,FALSE
         ret
.endif
mov eax,TRUE
ret

DlgProc endp

CleanUp proc
cmp fPaused, 1
jnz @F
INVOKE ResumeThread, hThread
@@: invoke  WaitForSingleObject,hThread,INFINITE
    invoke  CloseHandle,hThread
ret
CleanUp endp



Can you help me please

Thanks in forward
Title: Re: WaitForSingleObject
Post by: thomas_remkus on September 19, 2009, 01:21:28 PM
To start off with you might want to check your return values for those API. There might be a clue in there.
Title: Re: WaitForSingleObject
Post by: ragdog on September 19, 2009, 01:29:47 PM
No I need this check not

Thanks