[vlc-devel] [PATCH 1/3] Qt: Run mainloop on the main thread on OSX

Juho Vähä-Herttua juhovh at iki.fi
Sat Jul 31 20:12:38 CEST 2010


On 31.7.2010, at 21.00, Rémi Denis-Courmont wrote:
> AFAICT, the semaphore is there because [other platforms] initialize Qt4 in a 
> different thread.
> 
> Anyway, by design of a semaphore (in general), there is absolutely no point in 
> a semaphore that is only ever used from a single thread. It will either result 
> in a no-op or a deadlock, neither of which is useful.

On other platforms the semaphore is used to synchronize functions "Open" and "Thread", which run in different threads. On OSX I attempted to use the semaphore to synchronize functions "Close" and "Thread", from which I have no guarantee that they are run from the same thread.


On 31.7.2010, at 21.03, Rémi Denis-Courmont wrote:
> Le samedi 31 juillet 2010 20:58:08 Juho Vähä-Herttua, vous avez écrit :
>> I still need some way to make sure the Thread function has finished
>> execution before I cleanup in the Close since thread_join won't work, so
>> I'll wait for your reply on how it should be done without using the
>> semaphore.
> 
> That's intrinsic if you do not return from Open() until after you have cleaned 
> up...

If that's the case then it makes things a lot easier. I didn't want to rely on it, because there was commits like 7553630d1a "Do not assume that Open and Close are called in the same thread". But if you say that Close() can never be called before Open() has returned, I'll rely on that and prepare a patch accordingly.


Juho

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4215 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100731/3cd4cd82/attachment.bin>


More information about the vlc-devel mailing list