A Multithreading problem come from SendMessage
Hi, i have done my own video player which support lot's of video
format.....throught direct show or own source code....
but i have a small problem with a SendMessage...
User can perform 3 actions Play, Pause and Stop.....
* Play launch a thread and an SetEvent(E_PAUSE) to release it because thread
loop begin with a WaitForMultipleObject of E_PAUSE or E_KILL
* Pause ResetEvent(E_PAUSE)
* Stop ResetEvent(E_PAUSE) and SetEvent(E_KILL) and wait for Thread
Terminaison throught a WaitForSingleObject of E_END
The thread could be describe as :
WaitForMultipleObject of E_PAUSE or E_KILL
If E_KILL then Goto END_LABEL end if
Display frame and update SlideCtrl Position
END LABEL :
but when i want Stop the thread dead-lock can occur because SendMessage
(hide behind SetPos of the Slider Ctrl) wait for return....(blocking
fonction ....)....so if i wait in the stop function that E_END come and i
wait in my thread that the dialog treat the SETPOS message, my application
is locked .....
An advice will be welcome .....
Re: A Multithreading problem come from SendMessage
In message <firstname.lastname@example.org>, Alexandre Buisson
>Hi, i have done my own video player which support lot's of video
>format.....throught direct show or own source code....
>but i have a small problem with a SendMessage...[/color]
Use PostMessage. Never use SendMessage in multi-threaded apps when
wanting to send a message from the non UI-thread.
PostMessage can't block in the way you describe.
Object Media Limited [url]http://www.objmedia.demon.co.uk[/url]
RSI Information: [url]http://www.objmedia.demon.co.uk/rsi.html[/url]