vlc_threads: remove the thread priority when creating a thread

It is not used in POSIX systems. On other system it probably don't make a
difference anymore, only Windows has actual useful values for
VLC_THREAD_PRIORITY_XXX. The synchronization is more important than having some
threads called more often than others.
This commit is contained in:
Steve Lhomme 2022-04-25 18:11:51 +02:00
parent 38d85d937e
commit b469857dec
90 changed files with 106 additions and 174 deletions

View File

@ -656,12 +656,11 @@ VLC_API void *vlc_threadvar_get(vlc_threadvar_t);
* [OUT]
* @param entry entry point for the thread
* @param data data parameter given to the entry point
* @param priority thread priority value
* @return 0 on success, a standard error code on error.
* @note In case of error, the value of *th is undefined.
*/
VLC_API int vlc_clone(vlc_thread_t *th, void *(*entry)(void *), void *data,
int priority) VLC_USED;
VLC_API int vlc_clone(vlc_thread_t *th, void *(*entry)(void *),
void *data) VLC_USED;
/**
* Marks a thread as cancelled.

View File

@ -490,8 +490,7 @@ libvlc_media_list_player_new(libvlc_instance_t * p_instance)
goto error;
install_media_player_observer(p_mlp);
if (vlc_clone(&p_mlp->thread, playlist_thread, p_mlp,
VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&p_mlp->thread, playlist_thread, p_mlp))
{
libvlc_media_player_release(p_mlp->p_mi);
goto error;

View File

@ -498,7 +498,7 @@ static int Open (vlc_object_t *obj)
sys->es = es_out_Add (demux->out, &fmt);
demux->p_sys = sys;
if (vlc_clone (&sys->thread, Thread, demux, VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone (&sys->thread, Thread, demux))
{
es_out_Del (demux->out, sys->es);
goto error;

View File

@ -108,8 +108,7 @@ vlc_access_cache_InitOnce(void *data)
vlc_mutex_lock(&cache->lock);
cache->running = true;
int ret = vlc_clone(&cache->thread, vlc_access_cache_Thread, cache,
VLC_THREAD_PRIORITY_LOW);
int ret = vlc_clone(&cache->thread, vlc_access_cache_Thread, cache);
if (ret != 0)
cache->running = false;

View File

@ -209,8 +209,7 @@ static int Open( vlc_object_t *p_this )
p_sys->p_ev->pp_last = &p_sys->p_ev->p_frame;
p_sys->p_ev->p_access = p_access;
vlc_mutex_init( &p_sys->p_ev->lock );
if( vlc_clone( &p_sys->p_ev->thread, Raw1394EventThread,
p_sys->p_ev, VLC_THREAD_PRIORITY_OUTPUT ) )
if( vlc_clone( &p_sys->p_ev->thread, Raw1394EventThread, p_sys->p_ev ) )
{
msg_Err( p_access, "failed to clone event thread" );
Close( p_this );

View File

@ -889,8 +889,7 @@ struct vlc_http_conn *vlc_h2_conn_create(void *ctx, struct vlc_tls *tls)
vlc_cond_init(&conn->send_wait);
if (vlc_h2_conn_queue(conn, vlc_h2_frame_settings())
|| vlc_clone(&conn->thread, vlc_h2_recv_thread, conn,
VLC_THREAD_PRIORITY_INPUT))
|| vlc_clone(&conn->thread, vlc_h2_recv_thread, conn))
{
vlc_h2_output_destroy(conn->out);
goto error;

View File

@ -320,7 +320,7 @@ struct vlc_h2_output *vlc_h2_output_create(struct vlc_tls *tls, bool client)
void *(*cb)(void *) = client ? vlc_h2_client_output_thread
: vlc_h2_output_thread;
if (vlc_clone(&out->thread, cb, out, VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone(&out->thread, cb, out))
{
free(out);
out = NULL;

View File

@ -174,7 +174,7 @@ int main(void)
}
vlc_thread_t th;
if (vlc_clone(&th, proxy_thread, lfd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&th, proxy_thread, lfd))
assert(!"Thread error");
/* Test proxy error */

View File

@ -1603,8 +1603,7 @@ static void KeepAliveStart( stream_t *p_access )
vlc_sem_init( &p_sys->keep_alive.sem, 0 );
p_sys->b_keep_alive = !vlc_clone( &p_sys->keep_alive.thread,
KeepAliveThread, p_access,
VLC_THREAD_PRIORITY_LOW );
KeepAliveThread, p_access );
}
static void KeepAliveStop( stream_t *p_access )

View File

@ -471,7 +471,7 @@ static int Open( vlc_object_t *p_this )
goto error;
}
if ( vlc_clone( &p_sys->thread, DemuxThread, p_demux, VLC_THREAD_PRIORITY_INPUT ) != VLC_SUCCESS )
if ( vlc_clone( &p_sys->thread, DemuxThread, p_demux ) != VLC_SUCCESS )
{
msg_Err( p_demux, "can't spawn thread" );
freerdp_disconnect( p_sys->p_instance );

View File

@ -440,8 +440,7 @@ static int OpenSDP(vlc_object_t *obj)
if (err > 0 && module_exists("live555")) /* Bail out to live555 */
goto error;
if (vlc_clone(&sys->thread, rtp_dgram_thread, demux,
VLC_THREAD_PRIORITY_INPUT)) {
if (vlc_clone(&sys->thread, rtp_dgram_thread, demux)) {
rtp_session_destroy(demux, sys->session);
goto error;
}
@ -611,8 +610,7 @@ static int OpenURL(vlc_object_t *obj)
}
#endif
if (vlc_clone (&p_sys->thread, rtp_dgram_thread,
demux, VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone (&p_sys->thread, rtp_dgram_thread, demux))
goto error;
return VLC_SUCCESS;

View File

@ -770,7 +770,7 @@ static int satip_open(vlc_object_t *obj)
vlc_queue_Init(&sys->queue, offsetof (block_t, p_next));
if (vlc_clone(&sys->thread, satip_thread, access, VLC_THREAD_PRIORITY_INPUT)) {
if (vlc_clone(&sys->thread, satip_thread, access)) {
msg_Err(access, "Failed to create worker thread.");
goto error;
}

View File

@ -418,7 +418,7 @@ static int Open(vlc_object_t *obj)
/* Initializes demux */
sys->start = vlc_tick_now();
if (vlc_clone(&sys->thread, Thread, demux, VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone(&sys->thread, Thread, demux))
goto error;
demux->pf_demux = NULL;

View File

@ -359,7 +359,7 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
}
#endif
if (vlc_clone (&sys->thread, entry, demux, VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone (&sys->thread, entry, demux))
{
#ifdef ZVBI_COMPILED
if (sys->vbi != NULL)

View File

@ -474,7 +474,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_starttime = vlc_tick_now();
vlc_sem_init( &p_sys->closing, 0 );
if ( vlc_clone( &p_sys->thread, DemuxThread, p_demux, VLC_THREAD_PRIORITY_INPUT ) != VLC_SUCCESS )
if ( vlc_clone( &p_sys->thread, DemuxThread, p_demux ) != VLC_SUCCESS )
{
msg_Err( p_demux, "can't spawn thread" );
return VLC_EGENERIC;

View File

@ -1568,8 +1568,7 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
/* Run AudioTrack_Thread */
p_sys->b_thread_running = true;
p_sys->b_thread_paused = false;
if ( vlc_clone( &p_sys->thread, AudioTrack_Thread, p_aout,
VLC_THREAD_PRIORITY_LOW ) )
if ( vlc_clone( &p_sys->thread, AudioTrack_Thread, p_aout ) )
{
msg_Err(p_aout, "vlc clone failed");
goto error;

View File

@ -778,8 +778,7 @@ static HRESULT Start( vlc_object_t *obj, aout_stream_sys_t *sys,
}
}
int ret = vlc_clone(&sys->eraser_thread, PlayedDataEraser, (void*) obj,
VLC_THREAD_PRIORITY_LOW);
int ret = vlc_clone(&sys->eraser_thread, PlayedDataEraser, (void*) obj);
if( unlikely( ret ) )
{
if( ret != ENOMEM )

View File

@ -1299,7 +1299,7 @@ static int Open(vlc_object_t *obj)
}
sys->it = pv;
if (vlc_clone(&sys->thread, MMThread, aout, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, MMThread, aout))
{
IMMDeviceEnumerator_Release(sys->it);
LeaveMTA();

View File

@ -265,8 +265,7 @@ found:
p_sys->b_ready = false;
p_sys->p_input = NULL;
if( vlc_clone( &p_sys->thread, DecoderThread, p_dec,
VLC_THREAD_PRIORITY_INPUT ) )
if( vlc_clone( &p_sys->thread, DecoderThread, p_dec ) )
goto error;
vlc_mutex_lock( &p_sys->lock );

View File

@ -1002,8 +1002,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
goto bailout;
}
if (vlc_clone(&p_sys->out_thread, OutThread, p_dec,
VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&p_sys->out_thread, OutThread, p_dec))
{
msg_Err(p_dec, "vlc_clone failed");
vlc_mutex_unlock(&p_sys->lock);

View File

@ -481,7 +481,7 @@ static struct cli_client *cli_client_new(intf_thread_t *intf, int fd,
cl->intf = intf;
vlc_mutex_init(&cl->output_lock);
if (vlc_clone(&cl->thread, cli_client_thread, cl, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&cl->thread, cli_client_thread, cl))
{
free(cl);
cl = NULL;
@ -954,7 +954,7 @@ static int Activate( vlc_object_t *p_this )
intf_consoleIntroMsg( p_intf );
#endif
#endif
if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Run, p_intf ) )
goto error;
msg_print(p_intf, "%s",

View File

@ -329,7 +329,7 @@ static int Open( vlc_object_t *p_this )
p_intf, NULL ) )
goto late_failure;
if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Run, p_intf ) )
goto late_failure;
return VLC_SUCCESS;

View File

@ -75,7 +75,7 @@ static int Open( vlc_object_t *p_this )
vlc_mutex_init( &p_sys->lock );
vlc_sem_init( &p_sys->wait, 0 );
if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Thread, p_intf ) )
return VLC_ENOMEM;
vlc_sem_wait( &p_sys->wait );

View File

@ -134,7 +134,7 @@ static int Open( vlc_object_t *p_this )
}
Register( p_intf );
if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Thread, p_intf ) )
{
if( p_sys->p_map )
{

View File

@ -116,7 +116,7 @@ static int Open( vlc_object_t *p_this )
goto error;
}
if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Run, p_intf ) )
{
lirc_freeconfig( p_sys->config );
lirc_deinit();

View File

@ -304,8 +304,7 @@ static int PlaylistEvent(vlc_object_t *object, char const *cmd,
sys->input = input;
if (input != NULL) {
if (vlc_clone(&sys->thread, sys->is_master ? Master : Slave, intf,
VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone(&sys->thread, sys->is_master ? Master : Slave, intf))
sys->input = NULL;
}
return VLC_SUCCESS;

View File

@ -114,7 +114,7 @@ static int Activate( vlc_object_t *p_this )
p_intf->p_sys = p_sys;
if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Run, p_intf ) )
return VLC_ENOMEM;
return VLC_SUCCESS;

View File

@ -178,7 +178,7 @@ static int Open(vlc_object_t *obj)
/* Run the helper thread */
sys->ready = CreateEvent(NULL, FALSE, FALSE, NULL);
if (vlc_clone(&sys->thread, HelperThread, intf, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, HelperThread, intf))
{
free(sys);
msg_Err(intf, "one instance mode DISABLED "

View File

@ -168,8 +168,7 @@ bool PlaylistManager::start()
if(b_thread || b_preparsing)
return false;
b_thread = !vlc_clone(&thread, managerThread,
static_cast<void *>(this), VLC_THREAD_PRIORITY_INPUT);
b_thread = !vlc_clone(&thread, managerThread, static_cast<void *>(this));
if(!b_thread)
return false;

View File

@ -40,8 +40,7 @@ Downloader::Downloader()
bool Downloader::start()
{
if(!thread_handle_valid &&
vlc_clone(&thread_handle, downloaderThread,
static_cast<void *>(this), VLC_THREAD_PRIORITY_INPUT))
vlc_clone(&thread_handle, downloaderThread, static_cast<void *>(this)))
{
return false;
}

View File

@ -76,7 +76,7 @@ void event_thread_t::SetPci(const pci_t *data)
if( !is_running )
{
b_abort = false;
is_running = !vlc_clone( &thread, EventThread, this, VLC_THREAD_PRIORITY_LOW );
is_running = !vlc_clone( &thread, EventThread, this );
}
}
void event_thread_t::ResetPci()

View File

@ -1726,7 +1726,7 @@ static int Open(vlc_object_t *p_this)
if (!sys->playlist_listener)
return err;
if (vlc_clone(&sys->thread, Run, intf, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, Run, intf))
{
vlc_playlist_Lock(sys->playlist);
vlc_playlist_RemoveListener(sys->playlist, sys->playlist_listener);

View File

@ -511,7 +511,7 @@ static int OpenInternal( qt_intf_t *p_intf )
libvlc_SetExitHandler( vlc_object_instance(p_intf), Abort, p_intf );
Thread( (void *)p_intf );
#else
if( vlc_clone( &p_intf->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_intf->thread, Thread, p_intf ) )
{
return VLC_ENOMEM;
}

View File

@ -95,8 +95,7 @@ static int Open( vlc_object_t *p_this )
vlc_sem_init( &p_intf->p_sys->init_wait, 0 );
p_intf->p_sys->b_error = false;
if( vlc_clone( &p_intf->p_sys->thread, Run, p_intf,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_intf->p_sys->thread, Run, p_intf ) )
{
free( p_intf->p_sys );
return VLC_EGENERIC;

View File

@ -79,7 +79,7 @@ int Activate( extensions_manager_t *p_mgr, extension_t *p_ext )
p_sys->b_exiting = false;
p_sys->b_thread_running = true;
if( vlc_clone( &p_sys->thread, Run, p_ext, VLC_THREAD_PRIORITY_LOW )
if( vlc_clone( &p_sys->thread, Run, p_ext )
!= VLC_SUCCESS )
{
p_sys->b_exiting = true;

View File

@ -367,7 +367,7 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
p_sys->L = L;
if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Run, p_intf ) )
{
vlclua_fd_cleanup( &p_sys->dtable );
lua_close( p_sys->L );

View File

@ -239,7 +239,7 @@ int Open_LuaSD( vlc_object_t *p_this )
p_sys->dead = false;
vlc_queue_Init( &p_sys->queue, offsetof (struct sd_query, next) );
if( vlc_clone( &p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Run, p_sd ) )
{
goto error;
}

View File

@ -409,7 +409,7 @@ static int Open(vlc_object_t *p_this)
vlc_cond_init(&p_sys->wait);
vlc_sem_init(&p_sys->dead, 0);
if (vlc_clone(&p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&p_sys->thread, Run, p_intf))
{
retval = VLC_ENOMEM;
goto fail;

View File

@ -266,8 +266,7 @@ static int Open(vlc_object_t *p_this)
p_fingerprinter->pf_apply = ApplyResult;
var_Create( p_fingerprinter, "results-available", VLC_VAR_BOOL );
if( vlc_clone( &p_sys->thread, Run, p_fingerprinter,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Run, p_fingerprinter ) )
{
msg_Err( p_fingerprinter, "cannot spawn fingerprinter thread" );
goto error;

View File

@ -607,8 +607,7 @@ OpenCommon( vlc_object_t *p_obj, struct discovery_sys *p_sys, bool b_renderer )
goto error;
}
if( vlc_clone( &p_sys->thread, b_renderer ? RunRD : RunSD, p_obj,
VLC_THREAD_PRIORITY_LOW) )
if( vlc_clone( &p_sys->thread, b_renderer ? RunRD : RunSD, p_obj) )
{
msg_Err( p_obj, "Can't run the lookup thread" );
goto error;

View File

@ -328,7 +328,7 @@ static int Open( vlc_object_t *p_this )
vlc_once(&mtp_init_once, vlc_libmtp_init, NULL);
if (vlc_clone (&p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone (&p_sys->thread, Run, p_sd))
{
free (p_sys);
return VLC_EGENERIC;

View File

@ -131,7 +131,7 @@ static int Open( vlc_object_t *p_this )
var_Create( pl, "podcast-request", VLC_VAR_STRING );
var_AddCallback( pl, "podcast-request", Request, p_sys );
if (vlc_clone (&p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone (&p_sys->thread, Run, p_sd))
{
var_DelCallback( pl, "podcast-request", Request, p_sys );
free (p_sys);

View File

@ -581,7 +581,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_announces = 0;
p_sys->pp_announces = NULL;
/* TODO: create sockets here, and fix racy sockets table */
if (vlc_clone (&p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone (&p_sys->thread, Run, p_sd))
{
free (p_sys);
return VLC_EGENERIC;

View File

@ -274,7 +274,7 @@ static int Open (vlc_object_t *obj, const struct subsys *subsys)
}
udev_enumerate_unref (devenum);
if (vlc_clone (&p_sys->thread, Run, sd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone (&p_sys->thread, Run, sd))
{ /* Fallback without thread */
udev_monitor_unref (mon);
udev_unref (udev);

View File

@ -322,8 +322,7 @@ static int OpenSD( vlc_object_t *p_this )
/* XXX: Contrary to what the libupnp doc states, UpnpSearchAsync is
* blocking (select() and send() are called). Therefore, Call
* UpnpSearchAsync from an other thread. */
if ( vlc_clone( &p_sys->thread, SearchThread, p_this,
VLC_THREAD_PRIORITY_LOW ) )
if ( vlc_clone( &p_sys->thread, SearchThread, p_this ) )
{
p_sys->p_upnp->removeListener( p_sys->p_server_list );
p_sys->p_upnp->release();
@ -1632,8 +1631,7 @@ try
p_sys->p_renderer_list = std::make_shared<RD::MediaRendererList>( p_rd );
p_sys->p_upnp->addListener( p_sys->p_renderer_list );
if( vlc_clone( &p_sys->thread, SearchThread, (void*)p_rd,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, SearchThread, (void*)p_rd ) )
{
msg_Err( p_rd, "Can't run the lookup thread" );
p_sys->p_upnp->removeListener( p_sys->p_renderer_list );

View File

@ -176,7 +176,7 @@ static int Open (vlc_object_t *obj)
UpdateApps (sd);
if (vlc_clone (&p_sys->thread, Run, sd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone (&p_sys->thread, Run, sd))
goto error;
return VLC_SUCCESS;
@ -310,7 +310,7 @@ static int cmpapp (const void *a, const void *b)
if (wa < wb)
return -1;
return 0;
}
}
static void UpdateApps (services_discovery_t *sd)
{

View File

@ -273,8 +273,7 @@ static int Open (stream_t *stream, const char *path)
if (vlc_spawnp(&p_sys->pid, path, fdv, argv) == 0)
{
if (vlc_clone(&p_sys->thread, Thread, stream,
VLC_THREAD_PRIORITY_INPUT) == 0)
if (vlc_clone(&p_sys->thread, Thread, stream) == 0)
ret = VLC_SUCCESS;
}
else

View File

@ -1683,7 +1683,7 @@ static int Open( vlc_object_t *p_this )
s->pf_seek = NULL;
s->pf_control = Control;
if( vlc_clone( &p_sys->dl_thread, download_thread, s, VLC_THREAD_PRIORITY_INPUT ) )
if( vlc_clone( &p_sys->dl_thread, download_thread, s ) )
{
goto error;
}
@ -1691,7 +1691,7 @@ static int Open( vlc_object_t *p_this )
if( p_sys->live ) {
msg_Info( p_this, "Live stream detected" );
if( vlc_clone( &p_sys->live_thread, live_thread, s, VLC_THREAD_PRIORITY_INPUT ) )
if( vlc_clone( &p_sys->live_thread, live_thread, s ) )
{
goto error;
}

View File

@ -488,7 +488,7 @@ static int Open(vlc_object_t *obj)
stream->p_sys = sys;
if (vlc_clone(&sys->thread, Thread, stream, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, Thread, stream))
{
vlc_interrupt_destroy(sys->interrupt);
goto error;

View File

@ -143,8 +143,7 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
var_SetAddress( vlc_object_parent(vlc_object_parent(m_module)), CC_SHARED_VAR_NAME, &m_common );
// Start the Chromecast event thread.
if (vlc_clone(&m_chromecastThread, ChromecastThread, this,
VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&m_chromecastThread, ChromecastThread, this))
{
vlc_interrupt_destroy( m_ctl_thread_interrupt );
var_SetAddress( vlc_object_parent(vlc_object_parent(m_module)), CC_SHARED_VAR_NAME, NULL );
@ -226,7 +225,7 @@ void intf_sys_t::reinit()
}
m_state = Authenticating;
if( vlc_clone( &m_chromecastThread, ChromecastThread, this, VLC_THREAD_PRIORITY_LOW) )
if( vlc_clone( &m_chromecastThread, ChromecastThread, this) )
{
m_state = Dead;
delete m_communication;

View File

@ -1057,8 +1057,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
msg_Err( p_stream, "passive COMEDIA RTP socket failed" );
goto error;
}
if( vlc_clone( &id->listen.thread, rtp_listen_thread, id,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &id->listen.thread, rtp_listen_thread, id ) )
{
net_ListenClose( id->listen.fd );
id->listen.fd = NULL;
@ -1125,7 +1124,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
id->rtp_fmt.clock_rate, mcast_fd );
id->dead = false;
if( vlc_clone( &id->thread, ThreadSend, id, VLC_THREAD_PRIORITY_HIGHEST ) )
if( vlc_clone( &id->thread, ThreadSend, id ) )
{
id->dead = true;
goto error;

View File

@ -220,7 +220,7 @@ int DBMSDIOutput::Open()
decklink_iterator->Release();
if(vlc_clone(&feeder.thread, feederThreadCallback, this, VLC_THREAD_PRIORITY_INPUT))
if(vlc_clone(&feeder.thread, feederThreadCallback, this))
goto error;
return VLC_SUCCESS;

View File

@ -280,7 +280,7 @@ bool AbstractDecodedStream::init(const es_format_t *p_fmt)
return false;
}
if(vlc_clone(&thread, decoderThreadCallback, this, VLC_THREAD_PRIORITY_VIDEO))
if(vlc_clone(&thread, decoderThreadCallback, this))
{
es_format_Clean(&p_owner->decoder_out);
es_format_Clean(&p_owner->last_fmt_update);

View File

@ -42,7 +42,6 @@ typedef struct
struct
{
unsigned int i_count;
int i_priority;
uint32_t pool_size;
} threads;
} video;

View File

@ -468,7 +468,7 @@ int transcode_encoder_video_open( transcode_encoder_t *p_enc,
if( p_cfg->video.threads.i_count > 0 )
{
if( vlc_clone( &p_enc->thread, EncoderThread, p_enc, p_cfg->video.threads.i_priority ) )
if( vlc_clone( &p_enc->thread, EncoderThread, p_enc ) )
{
module_unneed( p_enc->p_encoder, p_enc->p_encoder->p_module );
p_enc->p_encoder->p_module = NULL;

View File

@ -211,7 +211,7 @@ vlc_module_begin ()
change_integer_range( 0, 32 )
add_integer( SOUT_CFG_PREFIX "pool-size", 10, POOL_TEXT, POOL_LONGTEXT )
change_integer_range( 1, 1000 )
add_bool( SOUT_CFG_PREFIX "high-priority", false, HP_TEXT, HP_LONGTEXT )
add_obsolete_bool( SOUT_CFG_PREFIX "high-priority" ) // Since 4.0.0
vlc_module_end ()
@ -322,13 +322,6 @@ static void SetVideoEncoderConfig( sout_stream_t *p_stream, transcode_encoder_co
p_cfg->video.threads.i_count = var_GetInteger( p_stream, SOUT_CFG_PREFIX "threads" );
p_cfg->video.threads.pool_size = var_GetInteger( p_stream, SOUT_CFG_PREFIX "pool-size" );
#if VLC_THREAD_PRIORITY_OUTPUT != VLC_THREAD_PRIORITY_VIDEO
if( var_GetBool( p_stream, SOUT_CFG_PREFIX "high-priority" ) )
p_cfg->video.threads.i_priority = VLC_THREAD_PRIORITY_OUTPUT;
else
#endif
p_cfg->video.threads.i_priority = VLC_THREAD_PRIORITY_VIDEO;
}
static void SetSPUEncoderConfig( sout_stream_t *p_stream, transcode_encoder_config_t *p_cfg )

View File

@ -475,8 +475,7 @@ static int Open(vout_display_t *vd,
sys->dead = false;
vlc_queue_Init(&sys->q, offsetof (vlc_caca_event_t, next));
if (vlc_clone(&sys->thread, VoutDisplayEventKeyDispatch, vd,
VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, VoutDisplayEventKeyDispatch, vd))
goto error;
sys->cursor_timeout = VLC_TICK_FROM_MS( var_InheritInteger(vd, "mouse-hide-timeout") );

View File

@ -717,7 +717,7 @@ static int Open(vout_window_t *wnd)
wnd->display.wl = display;
wnd->ops = &ops;
if (vlc_clone(&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, Thread, wnd))
goto error;
return VLC_SUCCESS;

View File

@ -181,8 +181,7 @@ int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event
atomic_store( &p_event->b_done, false);
p_event->b_error = false;
if( vlc_clone( &p_event->thread, EventThread, p_event,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_event->thread, EventThread, p_event ) )
{
msg_Err( p_event->obj, "cannot create Vout EventThread" );
return VLC_EGENERIC;

View File

@ -94,7 +94,7 @@ static int OpenInhibit (vlc_object_t *obj)
sys->exit = false;
/* SetThreadExecutionState always needs to be called from the same thread */
if (vlc_clone(&sys->thread, Run, ih, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, Run, ih))
return VLC_EGENERIC;
ih->inhibit = Inhibit;

View File

@ -721,7 +721,7 @@ static int Open(vout_window_t *wnd)
vlc_sem_init( &sys->ready, 0 );
wnd->sys = sys;
if( vlc_clone( &sys->thread, EventThread, wnd, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &sys->thread, EventThread, wnd ) )
{
Close(wnd);
return VLC_EGENERIC;

View File

@ -680,7 +680,7 @@ static int OpenCommon(vout_window_t *wnd, char *display,
/* Create the event thread. It will dequeue all events, so any checked
* request from this thread must be completed at this point. */
if (vlc_clone(&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sys->thread, Thread, wnd))
{
DeinitKeyboardExtension(wnd);
return VLC_ENOMEM;

View File

@ -222,8 +222,7 @@ static int Open(vlc_object_t * p_this)
vlc_gl_ReleaseCurrent(p_sys->gl);
/* Create the thread */
if (vlc_clone(&p_sys->thread, Thread, p_filter,
VLC_THREAD_PRIORITY_VIDEO)) {
if (vlc_clone(&p_sys->thread, Thread, p_filter)) {
vlc_gl_surface_Destroy(p_sys->gl);
return VLC_ENOMEM;
}

View File

@ -148,8 +148,7 @@ static int Open( vlc_object_t *p_this )
date_Set( &p_thread->date, VLC_TICK_0 );
p_thread->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
if( vlc_clone( &p_thread->thread,
Thread, p_thread, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_thread->thread, Thread, p_thread ) )
{
msg_Err( p_filter, "cannot launch goom thread" );
vout_Close( p_thread->p_vout );

View File

@ -195,8 +195,7 @@ static int Open( vlc_object_t * p_this )
goto error;
/* Create the thread */
if( vlc_clone( &p_sys->thread, Thread, p_filter,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Thread, p_filter ) )
{
vlc_gl_surface_Destroy( p_sys->gl );
goto error;

View File

@ -315,8 +315,7 @@ static int Open( vlc_object_t *p_this )
p_sys->dead = false;
vlc_queue_Init(&p_sys->queue, offsetof (block_t, p_next));
if( vlc_clone( &p_sys->thread, Thread, p_filter,
VLC_THREAD_PRIORITY_VIDEO ) )
if( vlc_clone( &p_sys->thread, Thread, p_filter ) )
{
vout_Close( p_sys->p_vout );
goto error;

View File

@ -139,8 +139,7 @@ static int Open( vlc_object_t * p_this )
goto error;
/* Create the thread */
if( vlc_clone( &p_sys->thread, Thread, p_filter,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_sys->thread, Thread, p_filter ) )
{
vlc_gl_surface_Destroy( p_sys->gl );
goto error;

View File

@ -137,10 +137,8 @@ static int vlc_clone_attr (vlc_thread_t *th, void *(*entry) (void *),
return ret;
}
int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data,
int priority)
int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data)
{
(void) priority;
return vlc_clone_attr (th, entry, data);
}

View File

@ -131,7 +131,7 @@ struct vlc_input_decoder_t
/* If p_aout is valid, then p_astream is valid too */
audio_output_t *p_aout;
vlc_aout_stream *p_astream;
vlc_aout_stream *p_astream;
vout_thread_t *p_vout;
bool vout_started;
@ -2082,7 +2082,6 @@ static vlc_input_decoder_t *
decoder_New( vlc_object_t *p_parent, const struct vlc_input_decoder_cfg *cfg )
{
const char *psz_type = cfg->sout ? N_("packetizer") : N_("decoder");
int i_priority;
/* Create the decoder configuration structure */
vlc_input_decoder_t *p_owner = CreateDecoder( p_parent, cfg );
@ -2106,13 +2105,6 @@ decoder_New( vlc_object_t *p_parent, const struct vlc_input_decoder_cfg *cfg )
assert( p_dec->fmt_in.i_cat != UNKNOWN_ES );
#if VLC_THREAD_PRIORITY_AUDIO != VLC_THREAD_PRIORITY_VIDEO
if( p_dec->fmt_in.i_cat == AUDIO_ES )
i_priority = VLC_THREAD_PRIORITY_AUDIO;
else
#endif
i_priority = VLC_THREAD_PRIORITY_VIDEO;
#ifdef ENABLE_SOUT
/* Do not delay sout creation for SPU or DATA. */
if( cfg->sout && cfg->fmt->b_packetized &&
@ -2129,7 +2121,7 @@ decoder_New( vlc_object_t *p_parent, const struct vlc_input_decoder_cfg *cfg )
#endif
/* Spawn the decoder thread */
if( vlc_clone( &p_owner->thread, DecoderThread, p_owner, i_priority ) )
if( vlc_clone( &p_owner->thread, DecoderThread, p_owner ) )
{
msg_Err( p_dec, "cannot spawn decoder thread" );
DeleteDecoder( p_owner, p_dec->fmt_in.i_cat );

View File

@ -119,8 +119,7 @@ vlc_demux_chained_t *vlc_demux_chained_New(vlc_object_t *parent,
vlc_mutex_init(&dc->lock);
if (vlc_clone(&dc->thread, vlc_demux_chained_Thread, dc,
VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone(&dc->thread, vlc_demux_chained_Thread, dc))
{
vlc_stream_Delete(dc->reader);
vlc_stream_fifo_Close(dc->writer);

View File

@ -910,7 +910,7 @@ static int TsStart( es_out_t *p_out )
p_ts->p_storage_w = NULL;
p_sys->b_delayed = true;
if( vlc_clone( &p_ts->thread, TsRun, p_ts, VLC_THREAD_PRIORITY_INPUT ) )
if( vlc_clone( &p_ts->thread, TsRun, p_ts ) )
{
msg_Err( p_sys->p_input, "cannot create timeshift thread" );

View File

@ -127,8 +127,7 @@ int input_Start( input_thread_t *p_input )
assert( !priv->is_running );
/* Create thread and wait for its readiness. */
priv->is_running = !vlc_clone( &priv->thread, func, priv,
VLC_THREAD_PRIORITY_INPUT );
priv->is_running = !vlc_clone( &priv->thread, func, priv );
if( !priv->is_running )
{
msg_Err( p_input, "cannot create input thread" );

View File

@ -145,7 +145,7 @@ vlm_t *vlm_New( libvlc_int_t *libvlc, const char *psz_vlmconf )
TAB_INIT( p_vlm->i_schedule, p_vlm->schedule );
var_Create( p_vlm, "intf-event", VLC_VAR_ADDRESS );
if( vlc_clone( &p_vlm->thread, Manage, p_vlm, VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_vlm->thread, Manage, p_vlm ) )
{
vlc_object_delete(p_vlm);
vlc_mutex_unlock( &vlm_mutex );

View File

@ -223,8 +223,8 @@ void addons_manager_Gather( addons_manager_t *p_manager, const char *psz_uri )
if( !p_manager->p_priv->finder.b_live )
{
if( vlc_clone( &p_manager->p_priv->finder.thread, FinderThread, p_manager,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_manager->p_priv->finder.thread, FinderThread, p_manager
) )
{
msg_Err( p_manager->p_priv->p_parent,
"cannot spawn entries provider thread" );
@ -537,8 +537,8 @@ static int InstallEntry( addons_manager_t *p_manager, addon_entry_t *p_entry )
ARRAY_APPEND( p_manager->p_priv->installer.entries, p_entry );
if( !p_manager->p_priv->installer.b_live )
{
if( vlc_clone( &p_manager->p_priv->installer.thread, InstallerThread, p_manager,
VLC_THREAD_PRIORITY_LOW ) )
if( vlc_clone( &p_manager->p_priv->installer.thread, InstallerThread, p_manager
) )
{
msg_Err( p_manager->p_priv->p_parent,
"cannot spawn addons installer thread" );

View File

@ -157,7 +157,7 @@ SpawnThread(vlc_executor_t *executor)
thread->owner = executor;
thread->current_task = NULL;
if (vlc_clone(&thread->thread, ThreadRun, thread, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&thread->thread, ThreadRun, thread))
{
free(thread);
return VLC_EGENERIC;

View File

@ -407,7 +407,7 @@ void update_Check( update_t *p_update, void (*pf_callback)( void*, bool ), void
p_uct->pf_callback = pf_callback;
p_uct->p_data = p_data;
vlc_clone( &p_uct->thread, update_CheckReal, p_uct, VLC_THREAD_PRIORITY_LOW );
vlc_clone( &p_uct->thread, update_CheckReal, p_uct );
}
void* update_CheckReal( void *obj )
@ -519,7 +519,7 @@ void update_Download( update_t *p_update, const char *psz_destdir )
p_udt->psz_destdir = psz_destdir ? strdup( psz_destdir ) : NULL;
atomic_store(&p_udt->aborted, false);
vlc_clone( &p_udt->thread, update_DownloadReal, p_udt, VLC_THREAD_PRIORITY_LOW );
vlc_clone( &p_udt->thread, update_DownloadReal, p_udt );
}
static void* update_DownloadReal( void *obj )

View File

@ -982,8 +982,7 @@ static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this,
host->p_tls = p_tls;
/* create the thread */
if (vlc_clone(&host->thread, httpd_HostThread, host,
VLC_THREAD_PRIORITY_LOW)) {
if (vlc_clone(&host->thread, httpd_HostThread, host)) {
msg_Err(p_this, "cannot spawn http host thread");
goto error;
}

View File

@ -445,7 +445,7 @@ static void vlc_entry( void *p )
}
int vlc_clone (vlc_thread_t *p_handle, void *(*entry) (void *),
void *data, int priority)
void *data)
{
struct vlc_thread *th = malloc (sizeof (*th));
if (unlikely(th == NULL))
@ -472,16 +472,6 @@ int vlc_clone (vlc_thread_t *p_handle, void *(*entry) (void *),
if (p_handle != NULL)
*p_handle = th;
if (priority)
{
LONG delta = PRTYD_MAXIMUM;
if (priority != VLC_THREAD_PRIORITY_HIGHEST)
delta >>= 1;
DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, delta, th->tid );
}
return 0;
error:

View File

@ -2018,7 +2018,7 @@ vlc_player_New(vlc_object_t *parent, enum vlc_player_lock_type lock_type,
vlc_player_InitTimer(player);
if (vlc_clone(&player->destructor.thread, vlc_player_destructor_Thread,
player, VLC_THREAD_PRIORITY_LOW) != 0)
player) != 0)
{
vlc_player_DestroyTimer(player);
goto error;

View File

@ -75,7 +75,7 @@ int vlc_getaddrinfo_i11e(const char *name, unsigned port,
vlc_sem_init(&req.done, 0);
if (vlc_clone(&th, vlc_gai_thread, &req, VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&th, vlc_gai_thread, &req))
return EAI_SYSTEM;
vlc_sem_wait_i11e(&req.done);

View File

@ -130,7 +130,7 @@ void vlc_threads_setup (libvlc_int_t *p_libvlc)
}
static int vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr,
void *(*entry) (void *), void *data, int priority)
void *(*entry) (void *), void *data)
{
int ret;
@ -179,17 +179,15 @@ static int vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr,
ret = pthread_create(&th->handle, attr, entry, data);
pthread_sigmask (SIG_SETMASK, &oldset, NULL);
pthread_attr_destroy (attr);
(void) priority;
return ret;
}
int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data,
int priority)
int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data)
{
pthread_attr_t attr;
pthread_attr_init (&attr);
return vlc_clone_attr (th, &attr, entry, data, priority);
return vlc_clone_attr (th, &attr, entry, data);
}
void vlc_join(vlc_thread_t th, void **result)

View File

@ -118,8 +118,7 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
timer->live = true;
atomic_init(&timer->overruns, 0);
if (vlc_clone (&timer->thread, vlc_timer_thread, timer,
VLC_THREAD_PRIORITY_INPUT))
if (vlc_clone (&timer->thread, vlc_timer_thread, timer))
{
free (timer);
return ENOMEM;

View File

@ -334,8 +334,7 @@ matched:
if (sap_addr->session_count++ == 0)
{
if (vlc_clone(&sap_addr->thread, RunThread, sap_addr,
VLC_THREAD_PRIORITY_LOW))
if (vlc_clone(&sap_addr->thread, RunThread, sap_addr))
{
msg_Err(obj, "unable to spawn SAP announce thread");
AddressDestroy(sap_addr);

View File

@ -177,16 +177,16 @@ int main (void)
test_context_simple(ctx);
assert(!vlc_clone(&th, test_thread_simple, ctx, VLC_THREAD_PRIORITY_LOW));
assert(!vlc_clone(&th, test_thread_simple, ctx));
vlc_interrupt_raise(ctx);
vlc_sem_post(&sem);
vlc_sem_post(&sem);
vlc_join(th, NULL);
assert(!vlc_clone(&th, test_thread_cleanup, ctx, VLC_THREAD_PRIORITY_LOW));
assert(!vlc_clone(&th, test_thread_cleanup, ctx));
vlc_join(th, NULL);
assert(!vlc_clone(&th, test_thread_cancel, ctx, VLC_THREAD_PRIORITY_LOW));
assert(!vlc_clone(&th, test_thread_cancel, ctx));
vlc_cancel(th);
vlc_join(th, NULL);

View File

@ -54,7 +54,7 @@ static int thread_return_magic = 0x4321;
// Spawn thread
#define TEST_THREAD_CLONE(th, f, data) \
assert(vlc_clone(th, f, data, VLC_THREAD_PRIORITY_LOW) == 0)
assert(vlc_clone(th, f, data) == 0)
// Spawn thread with magic data
#define TEST_THREAD_CLONE_MAGIC(th, f) \

View File

@ -2116,7 +2116,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
return -1;
}
atomic_store(&sys->control_is_terminated, false);
if (vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
if (vlc_clone(&sys->thread, Thread, vout)) {
vout_ReleaseDisplay(vout);
vout_DisableWindow(vout);
return -1;

View File

@ -1708,7 +1708,7 @@ spu_t *spu_Create(vlc_object_t *object, vout_thread_t *vout)
sys->last_sort_date = -1;
sys->vout = vout;
if(vlc_clone(&sys->prerender.thread, spu_PrerenderThread, spu, VLC_THREAD_PRIORITY_VIDEO))
if(vlc_clone(&sys->prerender.thread, spu_PrerenderThread, spu))
{
spu_Cleanup(spu);
vlc_object_delete(spu);

View File

@ -76,7 +76,7 @@ static inline bool vlc_mta_acquire( vlc_object_t *p_parent )
vlc_sem_init( &p_mta->ready_sem, 0 );
vlc_sem_init( &p_mta->release_sem, 0 );
p_mta->i_refcount = 1;
if ( vlc_clone( &p_mta->thread, MtaMainLoop, p_mta, VLC_THREAD_PRIORITY_LOW ) )
if ( vlc_clone( &p_mta->thread, MtaMainLoop, p_mta ) )
{
free( p_mta );
p_mta = NULL;

View File

@ -347,7 +347,7 @@ __stdcall vlc_entry (void *p)
}
int vlc_clone (vlc_thread_t *p_handle, void *(*entry) (void *),
void *data, int priority)
void *data)
{
struct vlc_thread *th = malloc (sizeof (*th));
if (unlikely(th == NULL))
@ -380,9 +380,6 @@ int vlc_clone (vlc_thread_t *p_handle, void *(*entry) (void *),
if (p_handle != NULL)
*p_handle = th;
if (priority)
SetThreadPriority (th->id, priority);
return 0;
}

View File

@ -97,7 +97,7 @@ static vlc_tls_t *securepair(vlc_thread_t *th,
server = vlc_tls_ServerSessionCreate(server_creds, socks[0], salpnv);
assert(server != NULL);
val = vlc_clone(th, tls_echo, server, VLC_THREAD_PRIORITY_LOW);
val = vlc_clone(th, tls_echo, server);
assert(val == 0);
client = vlc_tls_ClientSessionCreate(client_creds, socks[1],