[vlc-devel] [PATCH] misc/threads: fix cancellation during mwait

Filip Roséen filip at atch.se
Fri Aug 5 21:21:18 CEST 2016


I forgot to mark the patch in which this email is a reply to as RFC, input
is more than welcome even though the Subject lacks the acronym.

On 16/08/05 21:02, Filip Roséen wrote:

> Prior to this patch the while-loop in src/misc/threads.c:mwait would
> keep on spinning until the deadline has been reached, no matter if
> vlc_addr_timedwait woke up due to the thread being canceled.
> 
> This commit makes sure that we check whether or not the thread has
> been canceled, through vlc_testcancel, when vlc_addr_timedwait returns
> (in order to also take spurious wake-ups into account).

Elaboration of commit message
-----------------------------

Given the loop in `src/misc/threads.c:mwait` I assumed that it was put in
place to account for spurious wake-ups. The documentation associated with
`vlc_addr_timedwait` does however *not* include notion of such.

With the above in mind, if the patch in question is satisfying we should
probably update the documentation of `vlc_addr_timedwait`, if not; remove
the loop in `src/misc/threads.c:mwait` and make sure that each
implementation of `vlc_addr_timedwait` internally take spurious wake-ups
into account.

  - What are your thoughts?

--------------------------------------------------------------------------------

Disregarding the fact that I forgot to mark the patch as RFC, I also failed
to include a little ascii-art for the masses (I mean.. it's friday).

     __   __ _______ _______ _______ __   __                          
    |  | |  |   _   |       |       |  | |  |                         
    |  |_|  |  |_|  |    _  |    _  |  |_|  |                         
    |       |       |   |_| |   |_| |       |                         
    |       |       |    ___|    ___|_     _|                         
    |   _   |   _   |   |   |   |     |   |                           
    |__| |__|__| |__|___|   |___|     |___|                           
              _     _ _______ _______ ___   _ _______ __    _ ______  
             | | _ | |       |       |   | | |       |  |  | |      | 
             | || || |    ___|    ___|   |_| |    ___|   |_| |  _    |
             |       |   |___|   |___|      _|   |___|       | | |   |
             |       |    ___|    ___|     |_|    ___|  _    | |_|   |
             |   _   |   |___|   |___|    _  |   |___| | |   |       |
             |__| |__|_______|_______|___| |_|_______|_|  |__|______|

		/* my mind is a little bit too tired to think of a suitable animal/object,
       sorry for the "boring" message... Have a great weekend! */

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160805/a4468763/attachment.html>


More information about the vlc-devel mailing list