Understanding vlc_clone

This forum is about all development around libVLC.
Vaselinessa
Blank Cone
Blank Cone
Posts: 48
Joined: 03 Apr 2011 02:26
Location: Sacramento, CA

Understanding vlc_clone

Postby Vaselinessa » 18 Jan 2013 19:54

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Understanding vlc_clone

Postby Rémi Denis-Courmont » 18 Jan 2013 20:05

vlc_clone() and vlc_join() are modeled after pthread_create() and pthread_join(). Nothing particluar.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Vaselinessa
Blank Cone
Blank Cone
Posts: 48
Joined: 03 Apr 2011 02:26
Location: Sacramento, CA

Re: Understanding vlc_clone

Postby Vaselinessa » 19 Jan 2013 01:43

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.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests