13
0

Consolidate calls to `pthread_create' (1/2)

This commit is contained in:
Robin Gareus 2024-09-27 23:03:26 +02:00
parent 8d3ebde60e
commit 6a741689d1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 6 additions and 23 deletions

View File

@ -26,7 +26,6 @@
#include <libgen.h>
#include <assert.h>
#include <pthread.h>
#include <signal.h>
#include <glib.h>
#include <glibmm/timer.h>
@ -42,7 +41,6 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/time.h>
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 **/
static void*
gui_event_loop (void* ptr)
gui_event_loop (void*)
{
pthread_set_name ("LXVSTEventLoop");
VSTState* vstfx;
int LXVST_sched_timer_interval = 40; //ms, 25fps
XEvent event;
@ -509,20 +506,6 @@ int vstfx_init (void* ptr)
assert (gui_state == -1);
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*/
/*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*/
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)
{

View File

@ -97,7 +97,6 @@ build_query_string (ArdourCurl::HttpGet const & h)
static void*
_pingback (void *arg)
{
pthread_set_name ("Pingback");
ArdourCurl::HttpGet h;
//initialize curl
@ -177,7 +176,7 @@ void pingback (const string& version, const string& announce_path)
ping_call* cm = new ping_call (version, announce_path);
pthread_t thread;
pthread_create_and_store ("pingback", &thread, _pingback, cm);
pthread_create_and_store ("Pingback", &thread, _pingback, cm);
}
}

View File

@ -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 */
Completed.connect (_completed_connection, invalidator(*this), boost::bind (&StripSilenceDialog::update, this), gui_context ());
_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));
}
@ -248,7 +248,6 @@ void *
StripSilenceDialog::_detection_thread_work (void* arg)
{
StripSilenceDialog* d = reinterpret_cast<StripSilenceDialog*> (arg);
pthread_set_name ("SilenceDetect");
return d->detection_thread_work ();
}

View File

@ -274,6 +274,8 @@ VideoImageFrame::http_get (samplepos_t fn) {
queued_request=false;
req_video_frame_number=fn;
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);
thread_active=true;
if (rv) {