Consolidate calls to `pthread_create' (1/2)
This commit is contained in:
parent
8d3ebde60e
commit
6a741689d1
@ -26,7 +26,6 @@
|
|||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glibmm/timer.h>
|
#include <glibmm/timer.h>
|
||||||
@ -42,7 +41,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
struct ERect{
|
struct ERect{
|
||||||
@ -319,9 +317,8 @@ any Xevents to all the UI callbacks plugins 'may' have registered on their
|
|||||||
windows, that is if they don't manage their own UIs **/
|
windows, that is if they don't manage their own UIs **/
|
||||||
|
|
||||||
static void*
|
static void*
|
||||||
gui_event_loop (void* ptr)
|
gui_event_loop (void*)
|
||||||
{
|
{
|
||||||
pthread_set_name ("LXVSTEventLoop");
|
|
||||||
VSTState* vstfx;
|
VSTState* vstfx;
|
||||||
int LXVST_sched_timer_interval = 40; //ms, 25fps
|
int LXVST_sched_timer_interval = 40; //ms, 25fps
|
||||||
XEvent event;
|
XEvent event;
|
||||||
@ -509,20 +506,6 @@ int vstfx_init (void* ptr)
|
|||||||
assert (gui_state == -1);
|
assert (gui_state == -1);
|
||||||
pthread_mutex_init (&plugin_mutex, NULL);
|
pthread_mutex_init (&plugin_mutex, NULL);
|
||||||
|
|
||||||
int thread_create_result;
|
|
||||||
|
|
||||||
pthread_attr_t thread_attributes;
|
|
||||||
|
|
||||||
/*Init the attribs to defaults*/
|
|
||||||
|
|
||||||
pthread_attr_init (&thread_attributes);
|
|
||||||
|
|
||||||
/*Make sure the thread is joinable - this should be the default anyway -
|
|
||||||
so we can join to it on vstfx_exit*/
|
|
||||||
|
|
||||||
pthread_attr_setdetachstate (&thread_attributes, PTHREAD_CREATE_JOINABLE);
|
|
||||||
|
|
||||||
|
|
||||||
/*This is where we need to open a connection to X, and start the GUI thread*/
|
/*This is where we need to open a connection to X, and start the GUI thread*/
|
||||||
|
|
||||||
/*Open our connection to X - all linuxVST plugin UIs handled by the LXVST engine
|
/*Open our connection to X - all linuxVST plugin UIs handled by the LXVST engine
|
||||||
@ -546,7 +529,7 @@ int vstfx_init (void* ptr)
|
|||||||
|
|
||||||
/*Create the thread - use default attrs for now, don't think we need anything special*/
|
/*Create the thread - use default attrs for now, don't think we need anything special*/
|
||||||
|
|
||||||
thread_create_result = pthread_create (&LXVST_gui_event_thread, &thread_attributes, gui_event_loop, NULL);
|
int thread_create_result = pthread_create_and_store ("LXVSTEventLoop", &LXVST_gui_event_thread, gui_event_loop, NULL, 0);
|
||||||
|
|
||||||
if (thread_create_result != 0)
|
if (thread_create_result != 0)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,6 @@ build_query_string (ArdourCurl::HttpGet const & h)
|
|||||||
static void*
|
static void*
|
||||||
_pingback (void *arg)
|
_pingback (void *arg)
|
||||||
{
|
{
|
||||||
pthread_set_name ("Pingback");
|
|
||||||
ArdourCurl::HttpGet h;
|
ArdourCurl::HttpGet h;
|
||||||
|
|
||||||
//initialize curl
|
//initialize curl
|
||||||
@ -177,7 +176,7 @@ void pingback (const string& version, const string& announce_path)
|
|||||||
ping_call* cm = new ping_call (version, announce_path);
|
ping_call* cm = new ping_call (version, announce_path);
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
|
||||||
pthread_create_and_store ("pingback", &thread, _pingback, cm);
|
pthread_create_and_store ("Pingback", &thread, _pingback, cm);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
|
|||||||
/* Create a thread which runs while the dialogue is open to compute the silence regions */
|
/* Create a thread which runs while the dialogue is open to compute the silence regions */
|
||||||
Completed.connect (_completed_connection, invalidator(*this), boost::bind (&StripSilenceDialog::update, this), gui_context ());
|
Completed.connect (_completed_connection, invalidator(*this), boost::bind (&StripSilenceDialog::update, this), gui_context ());
|
||||||
_thread_should_finish = false;
|
_thread_should_finish = false;
|
||||||
pthread_create (&_thread, 0, StripSilenceDialog::_detection_thread_work, this);
|
pthread_create_and_store ("SilenceDetect", &_thread, StripSilenceDialog::_detection_thread_work, this, 0);
|
||||||
|
|
||||||
signal_response().connect(sigc::mem_fun (*this, &StripSilenceDialog::finished));
|
signal_response().connect(sigc::mem_fun (*this, &StripSilenceDialog::finished));
|
||||||
}
|
}
|
||||||
@ -248,7 +248,6 @@ void *
|
|||||||
StripSilenceDialog::_detection_thread_work (void* arg)
|
StripSilenceDialog::_detection_thread_work (void* arg)
|
||||||
{
|
{
|
||||||
StripSilenceDialog* d = reinterpret_cast<StripSilenceDialog*> (arg);
|
StripSilenceDialog* d = reinterpret_cast<StripSilenceDialog*> (arg);
|
||||||
pthread_set_name ("SilenceDetect");
|
|
||||||
return d->detection_thread_work ();
|
return d->detection_thread_work ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,6 +274,8 @@ VideoImageFrame::http_get (samplepos_t fn) {
|
|||||||
queued_request=false;
|
queued_request=false;
|
||||||
req_video_frame_number=fn;
|
req_video_frame_number=fn;
|
||||||
pthread_mutex_unlock(&queue_lock);
|
pthread_mutex_unlock(&queue_lock);
|
||||||
|
/* do not use `pbd pthread_create_and_store' here.
|
||||||
|
* The request thread uses aync cancellation */
|
||||||
int rv = pthread_create(&thread_id_tt, NULL, http_get_thread, this);
|
int rv = pthread_create(&thread_id_tt, NULL, http_get_thread, this);
|
||||||
thread_active=true;
|
thread_active=true;
|
||||||
if (rv) {
|
if (rv) {
|
||||||
|
Loading…
Reference in New Issue
Block a user