[vlc-devel] [PATCH]Win32 screensaver disable change part II

Rémi Denis-Courmont remi at remlab.net
Tue May 3 14:43:09 CEST 2011


   Hello,

On Tuesday 03 May 2011, Juha Jeronen wrote:
> - Have an instance data struct for the thread, containing only an exit
> flag (initialized to false in the main thread, just before it starts the
> new thread). Malloc it, and pass a pointer as the thread argument. The
> flag will be used for signaling.

Oh no, never suggest that. This does not fit our (POSIX) threaded memory 
synchronization model.

> - When the main thread wants to shut down the screensaver prevention
> thread, it sets the exit flag to true.
> - When the thread notices that its exit flag has been set to true, it
> joins.
> - Finally, we need to take care of the 50-second sleep. How about,
> instead of

No. Polling timers are for incompetent programmers.

In this case, the thread can sleep for 50 seconds, and be terminated by thread 
cancellation. Alternetiavely, it can use a condition variable and a 50-seconds 
time-out.

-- 
Rémi Denis-Courmont
http://www.remlab.info



More information about the vlc-devel mailing list