[vlc-devel] [PATCH v2 14/18] nacl: Add custom thread implementation

Thomas Guillem thomas at gllm.fr
Wed Mar 15 14:15:50 CET 2017



On Wed, Mar 15, 2017, at 12:27, Dennis Hamester wrote:
> 
> On 13.03.2017 20:35, Rémi Denis-Courmont wrote:
> > Le maanantaina 13. maaliskuuta 2017, 12.37.00 EET Dennis Hamester a écrit :
> >> From: Dennis Hamester <dennis.hamester at startmail.com>
> >>
> >> Similar to Android, NaCl has a pthread implementation without support
> >> for thread cancellation.
> >>
> >> We reuse posix/thread_nocancel and complement that with a custom
> >> implementation of futexes, which falls back to pthread mutexes and
> >> condition variables. Actual futexes are not available to regular
> >> NaCl modules.
> > 
> > Why do you simulate futeces when you could implement condition variables 
> > directly?
> 
> Our goal was to reuse src/android/thread.c, because it has a known
> working implementation of what VLC needs + custom cancel. And that file
> uses vlc_addr_broadcast.
> 
> The only alternative I see is to add a new branch in vlc_threads.h for
> nacl and implement everything ourselves with the exception of maybe some
> smaller parts in misc/threads.c. We can do it, but it will take time and
> there are many subtitles with regards to thread cancellation to get
> wrong. I'd rather not go down that road.
> 
> So, it is unfortunately not just condvars that we'd have to implement.
> If you have suggestions, please share them.

Thread cancellation is very hard to implement. It was done with condvars
in the past but it was buggy. Now that we have a working implementation
(with futexes) thanks to Rémi, I prefer to use it, even if it will be
less optimized than an implementation with condvars.

> 
> 
> > 
> > It made sense on Android - because Android supports them natively.
> > 
> 
> -- 
> Dennis Hamester
> Software Development
> -----------------------------------
> jusst technologies GmbH
> 
> tel: +49 (0)40 1800 86 75
> fax: +49 (0)40 1800 86 76
> mail: dhamester at jusst.de
> 
> Ohlstedter Straße 12
> 22397 Hamburg
> Deutschland
> 
> www.jusst.de
> 
> Vertretungsberechtigte Geschäftsführer: Julian Scheel, Wolfgang Scheel
> Registergericht: Amtsgericht Hamburg
> Registernummer: HRB 94300
> USt-ID-Nr.: DE 243309917
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> Email had 1 attachment:
> + signature.asc
>   1k (application/pgp-signature)


More information about the vlc-devel mailing list