Page 1 of 1

Understanding vlc_clone

Posted: 18 Jan 2013 19:54
by Vaselinessa
I've been using the following code to run myfunction() in a different thread. It runs fine on linux, but after cross-compiling, it crashes on windows when it reaches this code.

Code: Select all

vlc_thread_t mythread; void spawn_myfunction() { vlc_join( mythread, NULL ); vlc_clone( &mythread, myfunction, NULL, VLC_THREAD_PRIORITY_LOW ); }
I preceded the call to vlc_clone with a call to vlc_join to ensure that two instances of myfunction() don't run at the same time. Am I in error? What is the proper way to ensure that two instances do not run at once?

Re: Understanding vlc_clone

Posted: 18 Jan 2013 20:05
by RĂ©mi Denis-Courmont
vlc_clone() and vlc_join() are modeled after pthread_create() and pthread_join(). Nothing particluar.

Re: Understanding vlc_clone

Posted: 19 Jan 2013 01:43
by Vaselinessa
Thanks.

I suppose my problem was that (it appears to me that) vlc_join cannot run on a vlc_thread_t that either has not yet been initialized with vlc_clone() or has already been joined with vlc_join().

I got around the problem by removing calls to vlc_join and relying on mutex locks to prevent two function calls from running at the same time.