From b469857dec1cb427e5794a1e2930abccfe600d44 Mon Sep 17 00:00:00 2001 From: Steve Lhomme <robux4@ycbcr.xyz> Date: Mon, 25 Apr 2022 18:11:51 +0200 Subject: [PATCH] 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. --- include/vlc_threads.h | 5 ++--- lib/media_list_player.c | 3 +-- modules/access/alsa.c | 2 +- modules/access/cache.c | 3 +-- modules/access/dv.c | 3 +-- modules/access/http/h2conn.c | 3 +-- modules/access/http/h2output.c | 2 +- modules/access/http/tunnel_test.c | 2 +- modules/access/mms/mmstu.c | 3 +-- modules/access/rdp.c | 2 +- modules/access/rtp/rtp.c | 6 ++---- modules/access/satip.c | 2 +- modules/access/screen/wayland.c | 2 +- modules/access/v4l2/demux.c | 2 +- modules/access/vnc.c | 2 +- modules/audio_output/audiotrack.c | 3 +-- modules/audio_output/directsound.c | 3 +-- modules/audio_output/mmdevice.c | 2 +- modules/codec/dmo/dmo.c | 3 +-- modules/codec/omxil/mediacodec.c | 3 +-- modules/control/cli/cli.c | 4 ++-- modules/control/dbus/dbus.c | 2 +- modules/control/globalhotkeys/win32.c | 2 +- modules/control/globalhotkeys/xcb.c | 2 +- modules/control/lirc.c | 2 +- modules/control/netsync.c | 3 +-- modules/control/ntservice.c | 2 +- modules/control/win_msg.c | 2 +- modules/demux/adaptive/PlaylistManager.cpp | 3 +-- modules/demux/adaptive/http/Downloader.cpp | 3 +-- modules/demux/mkv/events.cpp | 2 +- modules/gui/ncurses.c | 2 +- modules/gui/qt/qt.cpp | 2 +- modules/gui/skins2/src/skin_main.cpp | 3 +-- modules/lua/extension_thread.c | 2 +- modules/lua/intf.c | 2 +- modules/lua/services_discovery.c | 2 +- modules/misc/audioscrobbler.c | 2 +- modules/misc/fingerprinter.c | 3 +-- modules/services_discovery/microdns.c | 3 +-- modules/services_discovery/mtp.c | 2 +- modules/services_discovery/podcast.c | 2 +- modules/services_discovery/sap.c | 2 +- modules/services_discovery/udev.c | 2 +- modules/services_discovery/upnp.cpp | 6 ++---- modules/services_discovery/xcb_apps.c | 4 ++-- modules/stream_filter/decomp.c | 3 +-- modules/stream_filter/hds/hds.c | 4 ++-- modules/stream_filter/prefetch.c | 2 +- modules/stream_out/chromecast/chromecast_ctrl.cpp | 5 ++--- modules/stream_out/rtp.c | 5 ++--- modules/stream_out/sdi/DBMSDIOutput.cpp | 2 +- modules/stream_out/sdi/SDIStream.cpp | 2 +- modules/stream_out/transcode/encoder/encoder.h | 1 - modules/stream_out/transcode/encoder/video.c | 2 +- modules/stream_out/transcode/transcode.c | 9 +-------- modules/video_output/caca.c | 3 +-- modules/video_output/wayland/xdg-shell.c | 2 +- modules/video_output/win32/events.c | 3 +-- modules/video_output/win32/inhibit.c | 2 +- modules/video_output/win32/window.c | 2 +- modules/video_output/xcb/window.c | 2 +- modules/visualization/glspectrum.c | 3 +-- modules/visualization/goom.c | 3 +-- modules/visualization/projectm.cpp | 3 +-- modules/visualization/visual/visual.c | 3 +-- modules/visualization/vsxu.cpp | 3 +-- src/android/thread.c | 4 +--- src/input/decoder.c | 12 ++---------- src/input/demux_chained.c | 3 +-- src/input/es_out_timeshift.c | 2 +- src/input/input.c | 3 +-- src/input/vlm.c | 2 +- src/misc/addons.c | 8 ++++---- src/misc/executor.c | 2 +- src/misc/update.c | 4 ++-- src/network/httpd.c | 3 +-- src/os2/thread.c | 12 +----------- src/player/player.c | 2 +- src/posix/getaddrinfo.c | 2 +- src/posix/thread.c | 8 +++----- src/posix/timer.c | 3 +-- src/stream_output/sap.c | 3 +-- src/test/interrupt.c | 6 +++--- src/test/thread.c | 2 +- src/video_output/video_output.c | 2 +- src/video_output/vout_subpictures.c | 2 +- src/win32/mta_holder.h | 2 +- src/win32/thread.c | 5 +---- test/modules/misc/tls.c | 2 +- 90 files changed, 106 insertions(+), 174 deletions(-) diff --git a/include/vlc_threads.h b/include/vlc_threads.h index 86a88938a190..20e86015930a 100644 --- a/include/vlc_threads.h +++ b/include/vlc_threads.h @@ -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. diff --git a/lib/media_list_player.c b/lib/media_list_player.c index ea52c6a2342d..b849df46198e 100644 --- a/lib/media_list_player.c +++ b/lib/media_list_player.c @@ -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; diff --git a/modules/access/alsa.c b/modules/access/alsa.c index c8a478a2ff6d..5078df503167 100644 --- a/modules/access/alsa.c +++ b/modules/access/alsa.c @@ -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; diff --git a/modules/access/cache.c b/modules/access/cache.c index 45c47e960d44..7436715b2f4e 100644 --- a/modules/access/cache.c +++ b/modules/access/cache.c @@ -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; diff --git a/modules/access/dv.c b/modules/access/dv.c index cb993427df2e..6dd16c009ac8 100644 --- a/modules/access/dv.c +++ b/modules/access/dv.c @@ -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 ); diff --git a/modules/access/http/h2conn.c b/modules/access/http/h2conn.c index d7917ec6d873..fcd471508859 100644 --- a/modules/access/http/h2conn.c +++ b/modules/access/http/h2conn.c @@ -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; diff --git a/modules/access/http/h2output.c b/modules/access/http/h2output.c index 74188ef29c45..a4d8c24fe652 100644 --- a/modules/access/http/h2output.c +++ b/modules/access/http/h2output.c @@ -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; diff --git a/modules/access/http/tunnel_test.c b/modules/access/http/tunnel_test.c index 223085714e8a..27ced152f459 100644 --- a/modules/access/http/tunnel_test.c +++ b/modules/access/http/tunnel_test.c @@ -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 */ diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c index 221bd52df480..c8b47cef899b 100644 --- a/modules/access/mms/mmstu.c +++ b/modules/access/mms/mmstu.c @@ -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 ) diff --git a/modules/access/rdp.c b/modules/access/rdp.c index b34d7008fd7f..ada9bfd5bb6d 100644 --- a/modules/access/rdp.c +++ b/modules/access/rdp.c @@ -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 ); diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c index acc03ace32cd..c665c49d1726 100644 --- a/modules/access/rtp/rtp.c +++ b/modules/access/rtp/rtp.c @@ -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; diff --git a/modules/access/satip.c b/modules/access/satip.c index ccff00552728..49eccc55d69f 100644 --- a/modules/access/satip.c +++ b/modules/access/satip.c @@ -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; } diff --git a/modules/access/screen/wayland.c b/modules/access/screen/wayland.c index 459017012bf2..0496727f3035 100644 --- a/modules/access/screen/wayland.c +++ b/modules/access/screen/wayland.c @@ -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; diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c index 5336af8fed53..48c5bc0fbd4a 100644 --- a/modules/access/v4l2/demux.c +++ b/modules/access/v4l2/demux.c @@ -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) diff --git a/modules/access/vnc.c b/modules/access/vnc.c index e3035690b717..89b72bf5ed8b 100644 --- a/modules/access/vnc.c +++ b/modules/access/vnc.c @@ -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; diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c index 137a35c7cdc5..9e243f8a6560 100644 --- a/modules/audio_output/audiotrack.c +++ b/modules/audio_output/audiotrack.c @@ -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; diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c index 73ddc38bfddd..eb2a1611271c 100644 --- a/modules/audio_output/directsound.c +++ b/modules/audio_output/directsound.c @@ -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 ) diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c index cc22828c677c..be043648f3e7 100644 --- a/modules/audio_output/mmdevice.c +++ b/modules/audio_output/mmdevice.c @@ -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(); diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c index 2aa58d8506f5..f98490e0c8a3 100644 --- a/modules/codec/dmo/dmo.c +++ b/modules/codec/dmo/dmo.c @@ -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 ); diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c index face408ced39..dba6b17abd90 100644 --- a/modules/codec/omxil/mediacodec.c +++ b/modules/codec/omxil/mediacodec.c @@ -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); diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c index 1a6114e9b0fb..b7b31d51fb2f 100644 --- a/modules/control/cli/cli.c +++ b/modules/control/cli/cli.c @@ -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", diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c index 595014510248..7cca7f5e30ac 100644 --- a/modules/control/dbus/dbus.c +++ b/modules/control/dbus/dbus.c @@ -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; diff --git a/modules/control/globalhotkeys/win32.c b/modules/control/globalhotkeys/win32.c index 926c6fc1749b..57406e148c1c 100644 --- a/modules/control/globalhotkeys/win32.c +++ b/modules/control/globalhotkeys/win32.c @@ -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 ); diff --git a/modules/control/globalhotkeys/xcb.c b/modules/control/globalhotkeys/xcb.c index d82620954eea..e50afeb9583c 100644 --- a/modules/control/globalhotkeys/xcb.c +++ b/modules/control/globalhotkeys/xcb.c @@ -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 ) { diff --git a/modules/control/lirc.c b/modules/control/lirc.c index dc96932e641b..3ff2ed951685 100644 --- a/modules/control/lirc.c +++ b/modules/control/lirc.c @@ -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(); diff --git a/modules/control/netsync.c b/modules/control/netsync.c index fbe448102cc7..907a8602e00b 100644 --- a/modules/control/netsync.c +++ b/modules/control/netsync.c @@ -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; diff --git a/modules/control/ntservice.c b/modules/control/ntservice.c index 25bf92adb0ae..bb14f2d428a0 100644 --- a/modules/control/ntservice.c +++ b/modules/control/ntservice.c @@ -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; diff --git a/modules/control/win_msg.c b/modules/control/win_msg.c index e658efaf6781..c0f25a17aafa 100644 --- a/modules/control/win_msg.c +++ b/modules/control/win_msg.c @@ -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 " diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp index c792acc0ff8a..90e7ae2e08b3 100644 --- a/modules/demux/adaptive/PlaylistManager.cpp +++ b/modules/demux/adaptive/PlaylistManager.cpp @@ -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; diff --git a/modules/demux/adaptive/http/Downloader.cpp b/modules/demux/adaptive/http/Downloader.cpp index 8aa76914688a..56bd7c05bc4e 100644 --- a/modules/demux/adaptive/http/Downloader.cpp +++ b/modules/demux/adaptive/http/Downloader.cpp @@ -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; } diff --git a/modules/demux/mkv/events.cpp b/modules/demux/mkv/events.cpp index cd7b57f1e94a..12c0a603d4f3 100644 --- a/modules/demux/mkv/events.cpp +++ b/modules/demux/mkv/events.cpp @@ -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() diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c index d0dc0bb5ba3b..9f807aa70cb5 100644 --- a/modules/gui/ncurses.c +++ b/modules/gui/ncurses.c @@ -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); diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index 418494788f68..a32e235f3760 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -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; } diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp index 476e9ecdacaf..8ac866ec260b 100644 --- a/modules/gui/skins2/src/skin_main.cpp +++ b/modules/gui/skins2/src/skin_main.cpp @@ -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; diff --git a/modules/lua/extension_thread.c b/modules/lua/extension_thread.c index 628d0c8375b3..dadf404bca50 100644 --- a/modules/lua/extension_thread.c +++ b/modules/lua/extension_thread.c @@ -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; diff --git a/modules/lua/intf.c b/modules/lua/intf.c index 688f856196ce..6595ba058b35 100644 --- a/modules/lua/intf.c +++ b/modules/lua/intf.c @@ -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 ); diff --git a/modules/lua/services_discovery.c b/modules/lua/services_discovery.c index 2dc3621c3b1d..45a73e12e72f 100644 --- a/modules/lua/services_discovery.c +++ b/modules/lua/services_discovery.c @@ -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; } diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c index 07de2ed7478a..e541e5e3006a 100644 --- a/modules/misc/audioscrobbler.c +++ b/modules/misc/audioscrobbler.c @@ -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; diff --git a/modules/misc/fingerprinter.c b/modules/misc/fingerprinter.c index dcda08f693c7..55dd69db1bdc 100644 --- a/modules/misc/fingerprinter.c +++ b/modules/misc/fingerprinter.c @@ -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; diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c index 2bb536c038b0..c9d3917b3976 100644 --- a/modules/services_discovery/microdns.c +++ b/modules/services_discovery/microdns.c @@ -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; diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c index b71596897439..a392abd8e7cf 100644 --- a/modules/services_discovery/mtp.c +++ b/modules/services_discovery/mtp.c @@ -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; diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c index ac3a987f187a..86b7e7426974 100644 --- a/modules/services_discovery/podcast.c +++ b/modules/services_discovery/podcast.c @@ -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); diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c index 651f1a597c4b..e40ceb5d768e 100644 --- a/modules/services_discovery/sap.c +++ b/modules/services_discovery/sap.c @@ -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; diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c index 59f57724335f..00dff08b6520 100644 --- a/modules/services_discovery/udev.c +++ b/modules/services_discovery/udev.c @@ -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); diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp index c5824ff15e73..5f3b3ed6ac4e 100644 --- a/modules/services_discovery/upnp.cpp +++ b/modules/services_discovery/upnp.cpp @@ -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 ); diff --git a/modules/services_discovery/xcb_apps.c b/modules/services_discovery/xcb_apps.c index 57aa8a50e0ab..9d946e0bbf53 100644 --- a/modules/services_discovery/xcb_apps.c +++ b/modules/services_discovery/xcb_apps.c @@ -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) { diff --git a/modules/stream_filter/decomp.c b/modules/stream_filter/decomp.c index 480d89b26f6b..d28a9a86cb8c 100644 --- a/modules/stream_filter/decomp.c +++ b/modules/stream_filter/decomp.c @@ -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 diff --git a/modules/stream_filter/hds/hds.c b/modules/stream_filter/hds/hds.c index 7f44a59e55a7..4f2551a7e229 100644 --- a/modules/stream_filter/hds/hds.c +++ b/modules/stream_filter/hds/hds.c @@ -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; } diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c index 195831884e21..5a1e113a963a 100644 --- a/modules/stream_filter/prefetch.c +++ b/modules/stream_filter/prefetch.c @@ -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; diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp index e0b3ef7a9ae5..1ec187ead018 100644 --- a/modules/stream_out/chromecast/chromecast_ctrl.cpp +++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp @@ -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; diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c index 496c159bfddf..088c9c1a8f0d 100644 --- a/modules/stream_out/rtp.c +++ b/modules/stream_out/rtp.c @@ -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; diff --git a/modules/stream_out/sdi/DBMSDIOutput.cpp b/modules/stream_out/sdi/DBMSDIOutput.cpp index 7619102a20cf..804d09397e69 100644 --- a/modules/stream_out/sdi/DBMSDIOutput.cpp +++ b/modules/stream_out/sdi/DBMSDIOutput.cpp @@ -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; diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp index fb9f39578a1d..d81521b599b3 100644 --- a/modules/stream_out/sdi/SDIStream.cpp +++ b/modules/stream_out/sdi/SDIStream.cpp @@ -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); diff --git a/modules/stream_out/transcode/encoder/encoder.h b/modules/stream_out/transcode/encoder/encoder.h index 22b1d7d1b2ca..e8544c50f2bb 100644 --- a/modules/stream_out/transcode/encoder/encoder.h +++ b/modules/stream_out/transcode/encoder/encoder.h @@ -42,7 +42,6 @@ typedef struct struct { unsigned int i_count; - int i_priority; uint32_t pool_size; } threads; } video; diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c index bc3ec46a30af..eb0d1cb39f91 100644 --- a/modules/stream_out/transcode/encoder/video.c +++ b/modules/stream_out/transcode/encoder/video.c @@ -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; diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c index 5d2b9a8e62d0..e98c89abf211 100644 --- a/modules/stream_out/transcode/transcode.c +++ b/modules/stream_out/transcode/transcode.c @@ -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 ) diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c index a67bc1da51f5..a3c5d92d40a7 100644 --- a/modules/video_output/caca.c +++ b/modules/video_output/caca.c @@ -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") ); diff --git a/modules/video_output/wayland/xdg-shell.c b/modules/video_output/wayland/xdg-shell.c index 861873519b7d..dc062b8f9515 100644 --- a/modules/video_output/wayland/xdg-shell.c +++ b/modules/video_output/wayland/xdg-shell.c @@ -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; diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c index ad6effbcf3c5..7e1c95a5387e 100644 --- a/modules/video_output/win32/events.c +++ b/modules/video_output/win32/events.c @@ -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; diff --git a/modules/video_output/win32/inhibit.c b/modules/video_output/win32/inhibit.c index 1bb55eb62e39..5172643dd752 100644 --- a/modules/video_output/win32/inhibit.c +++ b/modules/video_output/win32/inhibit.c @@ -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; diff --git a/modules/video_output/win32/window.c b/modules/video_output/win32/window.c index 866eedd64e83..1196d8b780de 100644 --- a/modules/video_output/win32/window.c +++ b/modules/video_output/win32/window.c @@ -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; diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c index 775dadd49de2..50a22f76e384 100644 --- a/modules/video_output/xcb/window.c +++ b/modules/video_output/xcb/window.c @@ -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; diff --git a/modules/visualization/glspectrum.c b/modules/visualization/glspectrum.c index 71cd5d10ef3e..32ae2819f457 100644 --- a/modules/visualization/glspectrum.c +++ b/modules/visualization/glspectrum.c @@ -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; } diff --git a/modules/visualization/goom.c b/modules/visualization/goom.c index 11a5113095d9..dc82e28d92ea 100644 --- a/modules/visualization/goom.c +++ b/modules/visualization/goom.c @@ -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 ); diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp index 22842e9acc44..4ff9911d61d4 100644 --- a/modules/visualization/projectm.cpp +++ b/modules/visualization/projectm.cpp @@ -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; diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c index 3ee7a6ecdd52..52655549d4dd 100644 --- a/modules/visualization/visual/visual.c +++ b/modules/visualization/visual/visual.c @@ -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; diff --git a/modules/visualization/vsxu.cpp b/modules/visualization/vsxu.cpp index a64317425fa8..561549c90d92 100644 --- a/modules/visualization/vsxu.cpp +++ b/modules/visualization/vsxu.cpp @@ -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; diff --git a/src/android/thread.c b/src/android/thread.c index 4ebba13e870f..b73b345a20c1 100644 --- a/src/android/thread.c +++ b/src/android/thread.c @@ -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); } diff --git a/src/input/decoder.c b/src/input/decoder.c index 2eafbe885c25..27fa099aab79 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -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 ); diff --git a/src/input/demux_chained.c b/src/input/demux_chained.c index 0d4b1b0f65fb..e33a4496fcb2 100644 --- a/src/input/demux_chained.c +++ b/src/input/demux_chained.c @@ -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); diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c index 07fed31fcb66..f6a7af19b8b1 100644 --- a/src/input/es_out_timeshift.c +++ b/src/input/es_out_timeshift.c @@ -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" ); diff --git a/src/input/input.c b/src/input/input.c index 402f1f749fda..45a85f6c800a 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -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" ); diff --git a/src/input/vlm.c b/src/input/vlm.c index 90534af775f3..a39b09be07f7 100644 --- a/src/input/vlm.c +++ b/src/input/vlm.c @@ -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 ); diff --git a/src/misc/addons.c b/src/misc/addons.c index 3f4e78bbc88b..21a890033090 100644 --- a/src/misc/addons.c +++ b/src/misc/addons.c @@ -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" ); diff --git a/src/misc/executor.c b/src/misc/executor.c index 3b79f9ba8d36..96c7d0c430fa 100644 --- a/src/misc/executor.c +++ b/src/misc/executor.c @@ -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; diff --git a/src/misc/update.c b/src/misc/update.c index 0231ea74de07..0ebd026e4303 100644 --- a/src/misc/update.c +++ b/src/misc/update.c @@ -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 ) diff --git a/src/network/httpd.c b/src/network/httpd.c index 003010560fff..f5d13d4ede94 100644 --- a/src/network/httpd.c +++ b/src/network/httpd.c @@ -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; } diff --git a/src/os2/thread.c b/src/os2/thread.c index 7fd4e9556a86..02825f81c7a9 100644 --- a/src/os2/thread.c +++ b/src/os2/thread.c @@ -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: diff --git a/src/player/player.c b/src/player/player.c index ded6e3f0591d..17d8a9022cd4 100644 --- a/src/player/player.c +++ b/src/player/player.c @@ -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; diff --git a/src/posix/getaddrinfo.c b/src/posix/getaddrinfo.c index c7f9bf07b57d..2c930fa0bfc8 100644 --- a/src/posix/getaddrinfo.c +++ b/src/posix/getaddrinfo.c @@ -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); diff --git a/src/posix/thread.c b/src/posix/thread.c index 78045d9746e4..49e786d309de 100644 --- a/src/posix/thread.c +++ b/src/posix/thread.c @@ -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) diff --git a/src/posix/timer.c b/src/posix/timer.c index d88df7d501bc..428053238088 100644 --- a/src/posix/timer.c +++ b/src/posix/timer.c @@ -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; diff --git a/src/stream_output/sap.c b/src/stream_output/sap.c index c58750fcc55a..595723e1b1d3 100644 --- a/src/stream_output/sap.c +++ b/src/stream_output/sap.c @@ -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); diff --git a/src/test/interrupt.c b/src/test/interrupt.c index 808335575b1c..05f5e88a48bf 100644 --- a/src/test/interrupt.c +++ b/src/test/interrupt.c @@ -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); diff --git a/src/test/thread.c b/src/test/thread.c index a8eaeed9ce43..2616fb4a4765 100644 --- a/src/test/thread.c +++ b/src/test/thread.c @@ -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) \ diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 7b03fca64140..a2eb1618f9f5 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -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; diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index ea03a16d57ee..73c2cca04b30 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -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); diff --git a/src/win32/mta_holder.h b/src/win32/mta_holder.h index 8a6f38344045..1d13e7c7f648 100644 --- a/src/win32/mta_holder.h +++ b/src/win32/mta_holder.h @@ -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; diff --git a/src/win32/thread.c b/src/win32/thread.c index 925cdee15b37..d3431a7d1fe4 100644 --- a/src/win32/thread.c +++ b/src/win32/thread.c @@ -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; } diff --git a/test/modules/misc/tls.c b/test/modules/misc/tls.c index 8005c5dc86a5..efbd171086b0 100644 --- a/test/modules/misc/tls.c +++ b/test/modules/misc/tls.c @@ -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], -- GitLab