[vlc-devel] [PATCH 5/6] rename msleep() to vlc_tick_sleep()
Steve Lhomme
robux4 at ycbcr.xyz
Wed Jun 20 08:54:35 CEST 2018
---
include/vlc_interrupt.h | 2 +-
include/vlc_threads.h | 6 +++---
modules/access/avcapture.m | 2 +-
modules/access/bluray.c | 4 ++--
modules/access/dc1394.c | 2 +-
modules/access/dtv/en50221.c | 4 ++--
modules/access/dtv/linux.c | 10 +++++-----
modules/access/dvb/linux_dvb.c | 8 ++++----
modules/access/dvdnav.c | 4 ++--
modules/access/http/h2output_test.c | 6 +++---
modules/access/idummy.c | 4 ++--
modules/access/jack.c | 4 ++--
modules/access/mms/mmstu.c | 2 +-
modules/access/qtsound.m | 2 +-
modules/access/satip.c | 2 +-
modules/access_output/shout.c | 2 +-
modules/audio_output/coreaudio_common.c | 4 ++--
modules/audio_output/directsound.c | 2 +-
modules/audio_output/jack.c | 2 +-
modules/audio_output/opensles_android.c | 2 +-
modules/audio_output/pulse.c | 2 +-
modules/audio_output/wasapi.c | 2 +-
modules/audio_output/waveout.c | 2 +-
modules/codec/avcodec/va_surface.c | 2 +-
modules/codec/gstreamer/gstdecode.c | 2 +-
modules/codec/qsv.c | 2 +-
modules/control/motion.c | 2 +-
modules/control/netsync.c | 2 +-
modules/control/oldrc.c | 2 +-
modules/demux/adaptive/PlaylistManager.cpp | 2 +-
modules/demux/avi/avi.c | 6 +++---
modules/demux/mp4/heif.c | 2 +-
modules/hw/vdpau/avcodec.c | 2 +-
modules/misc/fingerprinter.c | 2 +-
modules/services_discovery/mtp.c | 4 ++--
modules/spu/remoteosd.c | 2 +-
modules/video_output/decklink.cpp | 4 ++--
src/darwin/thread.c | 6 +++---
src/input/decoder.c | 2 +-
src/input/es_out.c | 2 +-
src/libvlccore.sym | 2 +-
src/misc/threads.c | 2 +-
src/os2/thread.c | 4 ++--
src/posix/thread.c | 4 ++--
src/test/timer.c | 2 +-
src/win32/thread.c | 2 +-
test/libvlc/media.c | 2 +-
test/libvlc/media_list_player.c | 2 +-
test/src/interface/dialog.c | 10 +++++-----
49 files changed, 78 insertions(+), 78 deletions(-)
diff --git a/include/vlc_interrupt.h b/include/vlc_interrupt.h
index 20ae7e832c..530977fc6c 100644
--- a/include/vlc_interrupt.h
+++ b/include/vlc_interrupt.h
@@ -72,7 +72,7 @@ VLC_API int vlc_sem_wait_i11e(vlc_sem_t *);
VLC_API int vlc_mwait_i11e(vlc_tick_t);
/**
- * Interruptible variant of msleep().
+ * Interruptible variant of vlc_tick_sleep().
*
* Waits for a specified timeout duration or, if the calling thread has an
* interruption context, an interruption.
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 46e8fd53b1..7cd71cc472 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -833,7 +833,7 @@ VLC_API unsigned long vlc_thread_id(void) VLC_USED;
*
* In principles, the clock has a precision of 1 MHz. But the actual resolution
* may be much lower, especially when it comes to sleeping with vlc_tick_wait() or
- * msleep(). Most general-purpose operating systems provide a resolution of
+ * vlc_tick_sleep(). Most general-purpose operating systems provide a resolution of
* only 100 to 1000 Hz.
*
* \warning The origin date (time value "zero") is not specified. It is
@@ -862,7 +862,7 @@ VLC_API void vlc_tick_wait(vlc_tick_t deadline);
* \note The delay may be exceeded due to OS scheduling.
* \note This function is a cancellation point.
*/
-VLC_API void msleep(vlc_tick_t delay);
+VLC_API void vlc_tick_sleep(vlc_tick_t delay);
#define VLC_HARD_MIN_SLEEP (CLOCK_FREQ/100) /* 10 milliseconds = 1 tick at 100Hz */
#define VLC_SOFT_MIN_SLEEP (9*CLOCK_FREQ) /* 9 seconds */
@@ -917,7 +917,7 @@ vlc_tick_t impossible_deadline( vlc_tick_t deadline )
# define check_deadline(d) (d)
#endif
-#define msleep(d) msleep(check_delay(d))
+#define vlc_tick_sleep(d) vlc_tick_sleep(check_delay(d))
#define vlc_tick_wait(d) vlc_tick_wait(check_deadline(d))
/**
diff --git a/modules/access/avcapture.m b/modules/access/avcapture.m
index 9f36d2c256..6d7ffa77ec 100644
--- a/modules/access/avcapture.m
+++ b/modules/access/avcapture.m
@@ -408,7 +408,7 @@ static int Demux(demux_t *p_demux)
{
/* Nothing to display yet, just forget */
block_Release(p_block);
- msleep(VLC_HARD_MIN_SLEEP);
+ vlc_tick_sleep(VLC_HARD_MIN_SLEEP);
return 1;
}
else if ( !p_sys->b_es_setup )
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index bd6515072a..74db7ce305 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -2216,7 +2216,7 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout )
}
/* avoid busy loops (read returns no data) */
- msleep( 40000 );
+ vlc_tick_sleep( 40000 );
}
static void blurayStreamSelect(demux_t *p_demux, uint32_t i_type, uint32_t i_id)
@@ -2400,7 +2400,7 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
case BD_EVENT_IDLE:
/* nothing to do (ex. BD-J is preparing menus, waiting user input or running animation) */
/* avoid busy loop (bd_read() returns no data) */
- msleep( 40000 );
+ vlc_tick_sleep( 40000 );
break;
default:
diff --git a/modules/access/dc1394.c b/modules/access/dc1394.c
index b8312d3d62..9f14f2a2f8 100644
--- a/modules/access/dc1394.c
+++ b/modules/access/dc1394.c
@@ -470,7 +470,7 @@ static int Demux( demux_t *p_demux )
/* Sleep so we do not consume all the cpu, 10ms seems
* like a good value (100fps)
*/
- msleep( VLC_HARD_MIN_SLEEP );
+ vlc_tick_sleep( VLC_HARD_MIN_SLEEP );
return 1;
}
diff --git a/modules/access/dtv/en50221.c b/modules/access/dtv/en50221.c
index fca72dd053..1d0a61fe45 100644
--- a/modules/access/dtv/en50221.c
+++ b/modules/access/dtv/en50221.c
@@ -1267,7 +1267,7 @@ static void CAPMTAdd( cam_t * p_cam, int i_session_id,
}
#ifdef CAPMT_WAIT
- msleep( CAPMT_WAIT * 1000 );
+ vlc_tick_sleep( CAPMT_WAIT * 1000 );
#endif
msg_Dbg( p_cam->obj, "adding CAPMT for SID %d on session %d",
@@ -1960,7 +1960,7 @@ cam_t *en50221_Init( vlc_object_t *obj, int fd )
p_cam->i_timeout = CLOCK_FREQ / 10;
/* Wait a bit otherwise it doesn't initialize properly... */
- msleep( CLOCK_FREQ / 10 );
+ vlc_tick_sleep( CLOCK_FREQ / 10 );
p_cam->i_next_event = 0;
}
else
diff --git a/modules/access/dtv/linux.c b/modules/access/dtv/linux.c
index 7a9b24abbc..e5d75d03f2 100644
--- a/modules/access/dtv/linux.c
+++ b/modules/access/dtv/linux.c
@@ -821,7 +821,7 @@ known:
unsigned satno = var_InheritInteger (d->obj, "dvb-satno");
if (satno > 0)
{
-#undef msleep /* we know what we are doing! */
+#undef vlc_tick_sleep /* we know what we are doing! */
/* DiSEqC Bus Specification:
http://www.eutelsat.com/satellites/pdf/Diseqc/Reference%20docs/bus_spec.pdf */
@@ -843,7 +843,7 @@ known:
cmd.msg[4] = cmd.msg[5] = 0; /* unused */
cmd.msg_len = 4; /* length */
- msleep (15000); /* wait 15 ms before DiSEqC command */
+ vlc_tick_sleep (15000); /* wait 15 ms before DiSEqC command */
unsigned uncommitted = var_InheritInteger (d->obj, "dvb-uncommitted");
if (uncommitted > 0)
{
@@ -872,7 +872,7 @@ known:
vlc_strerror_c(errno));
return -1;
}
- msleep(125000); /* wait 125 ms before committed DiSEqC command */
+ vlc_tick_sleep(125000); /* wait 125 ms before committed DiSEqC command */
}
if (ioctl (d->frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd) < 0)
{
@@ -880,7 +880,7 @@ known:
vlc_strerror_c(errno));
return -1;
}
- msleep (54000 + 15000);
+ vlc_tick_sleep (54000 + 15000);
/* Mini-DiSEqC */
satno &= 1;
@@ -891,7 +891,7 @@ known:
vlc_strerror_c(errno));
return -1;
}
- msleep (15000);
+ vlc_tick_sleep (15000);
}
/* Continuous tone (to select high oscillator frequency) */
diff --git a/modules/access/dvb/linux_dvb.c b/modules/access/dvb/linux_dvb.c
index 580e44dac2..2650a7213c 100644
--- a/modules/access/dvb/linux_dvb.c
+++ b/modules/access/dvb/linux_dvb.c
@@ -685,7 +685,7 @@ static int DoDiseqc( vlc_object_t *p_access, dvb_sys_t *p_sys )
}
/* Wait for at least 15 ms. */
- msleep(15000);
+ vlc_tick_sleep(15000);
i_val = var_GetInteger( p_access, "dvb-satno" );
if( i_val > 0 && i_val < 5 )
@@ -713,7 +713,7 @@ static int DoDiseqc( vlc_object_t *p_access, dvb_sys_t *p_sys )
return VLC_EGENERIC;
}
- msleep(15000 + cmd.wait * 1000);
+ vlc_tick_sleep(15000 + cmd.wait * 1000);
/* A or B simple diseqc ("diseqc-compatible") */
if( ioctl( p_sys->i_frontend_handle, FE_DISEQC_SEND_BURST,
@@ -724,7 +724,7 @@ static int DoDiseqc( vlc_object_t *p_access, dvb_sys_t *p_sys )
return VLC_EGENERIC;
}
- msleep(15000);
+ vlc_tick_sleep(15000);
}
if( ioctl( p_sys->i_frontend_handle, FE_SET_TONE, fe_tone ) )
@@ -735,7 +735,7 @@ static int DoDiseqc( vlc_object_t *p_access, dvb_sys_t *p_sys )
return VLC_EGENERIC;
}
- msleep(50000);
+ vlc_tick_sleep(50000);
return 0;
}
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 33af82903d..b20cb4d6a5 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -884,7 +884,7 @@ static int Demux( demux_t *p_demux )
DemuxForceStill( p_demux );
p_sys->b_reset_pcr = true;
}
- msleep( 40000 );
+ vlc_tick_sleep( 40000 );
break;
}
@@ -1109,7 +1109,7 @@ static int Demux( demux_t *p_demux )
es_out_Control( p_demux->out, ES_OUT_GET_EMPTY, &b_empty );
if( !b_empty )
{
- msleep( 40*1000 );
+ vlc_tick_sleep( 40*1000 );
}
else
{
diff --git a/modules/access/http/h2output_test.c b/modules/access/http/h2output_test.c
index 18afa3c5bc..b23a74b2bc 100644
--- a/modules/access/http/h2output_test.c
+++ b/modules/access/http/h2output_test.c
@@ -34,7 +34,7 @@
#include "h2frame.h"
#include "h2output.h"
-#undef msleep
+#undef vlc_tick_sleep
static unsigned char counter = 0;
static bool send_failure = false;
@@ -160,7 +160,7 @@ int main(void)
assert(vlc_h2_output_send(out, frame(10)) == 0);
for (unsigned char i = 11; vlc_h2_output_send(out, frame(i)) == 0; i++)
- msleep(CLOCK_FREQ/10); /* eventually, it should start failing */
+ vlc_tick_sleep(CLOCK_FREQ/10); /* eventually, it should start failing */
assert(vlc_h2_output_send(out, frame(0)) == -1);
assert(vlc_h2_output_send_prio(out, frame(0)) == -1);
vlc_h2_output_destroy(out);
@@ -174,7 +174,7 @@ int main(void)
vlc_sem_wait(&rx);
for (unsigned char i = 1; vlc_h2_output_send_prio(out, frame(i)) == 0; i++)
- msleep(CLOCK_FREQ/10);
+ vlc_tick_sleep(CLOCK_FREQ/10);
assert(vlc_h2_output_send(out, frame(0)) == -1);
assert(vlc_h2_output_send_prio(out, frame(0)) == -1);
vlc_h2_output_destroy(out);
diff --git a/modules/access/idummy.c b/modules/access/idummy.c
index 1672c71aa2..95618a1172 100644
--- a/modules/access/idummy.c
+++ b/modules/access/idummy.c
@@ -56,7 +56,7 @@ static int DemuxNoOp( demux_t *demux )
static int DemuxHold( demux_t *demux )
{
(void) demux;
- msleep( VLC_HARD_MIN_SLEEP ); /* FIXME!!! */
+ vlc_tick_sleep( VLC_HARD_MIN_SLEEP ); /* FIXME!!! */
return 1;
}
@@ -74,7 +74,7 @@ static int DemuxPause( demux_t *demux )
if( now >= p_sys->end )
return 0;
- msleep( VLC_HARD_MIN_SLEEP ); /* FIXME!!! */
+ vlc_tick_sleep( VLC_HARD_MIN_SLEEP ); /* FIXME!!! */
return 1;
}
diff --git a/modules/access/jack.c b/modules/access/jack.c
index 5d4dab5fba..782b85488d 100644
--- a/modules/access/jack.c
+++ b/modules/access/jack.c
@@ -432,9 +432,9 @@ static block_t *GrabJack( demux_t *p_demux )
if( i_read < 100 ) /* avoid small read */
{ /* vlc has too much free time on its hands? */
-#undef msleep
+#undef vlc_tick_sleep
#warning Hmm.... looks wrong
- msleep(1000);
+ vlc_tick_sleep(1000);
return NULL;
}
diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index 16c99d1609..db71b64630 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -1611,7 +1611,7 @@ noreturn static void *KeepAliveThread( void *p_data )
vlc_restorecancel( canc );
- msleep( 10 * CLOCK_FREQ );
+ vlc_tick_sleep( 10 * CLOCK_FREQ );
}
vlc_assert_unreachable();
}
diff --git a/modules/access/qtsound.m b/modules/access/qtsound.m
index 0c368c21f3..442bcc72c1 100644
--- a/modules/access/qtsound.m
+++ b/modules/access/qtsound.m
@@ -517,7 +517,7 @@ static int Demux(demux_t *p_demux)
block_Release(p_blocka);
// Nothing to transfer yet, just forget
- msleep(VLC_HARD_MIN_SLEEP);
+ vlc_tick_sleep(VLC_HARD_MIN_SLEEP);
return 1;
}
diff --git a/modules/access/satip.c b/modules/access/satip.c
index 81d45d6b37..59012a57c3 100644
--- a/modules/access/satip.c
+++ b/modules/access/satip.c
@@ -415,7 +415,7 @@ static void satip_teardown(void *data) {
/* Extra sleep for compatibility with some satip servers, that
* can't handle new sessions right after teardown */
- msleep(150000);
+ vlc_tick_sleep(150000);
}
}
}
diff --git a/modules/access_output/shout.c b/modules/access_output/shout.c
index 6e25fbf870..a5d025e369 100644
--- a/modules/access_output/shout.c
+++ b/modules/access_output/shout.c
@@ -367,7 +367,7 @@ static int Open( vlc_object_t *p_this )
if ( i_ret != SHOUTERR_CONNECTED )
{
msg_Warn( p_access, "unable to establish connection, retrying..." );
- msleep( 30000000 );
+ vlc_tick_sleep( 30000000 );
}
}
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index 8b217a47f8..8ade888968 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -246,7 +246,7 @@ ca_Flush(audio_output_t *p_aout, bool wait)
const vlc_tick_t i_frame_us =
FramesToUs(p_sys, BytesToFrames(p_sys, p_sys->i_out_size)) + 10000;
lock_unlock(p_sys);
- msleep(i_frame_us);
+ vlc_tick_sleep(i_frame_us);
lock_lock(p_sys);
}
}
@@ -332,7 +332,7 @@ ca_Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date)
/* Wait for the render buffer to play the remaining data */
lock_unlock(p_sys);
- msleep(i_frame_us);
+ vlc_tick_sleep(i_frame_us);
lock_lock(p_sys);
}
else
diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index b781d44271..d460b13896 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -1170,7 +1170,7 @@ static void * PlayedDataEraser( void * data )
wait:
vlc_mutex_unlock(&p_sys->lock);
vlc_restorecancel(canc);
- msleep(tosleep);
+ vlc_tick_sleep(tosleep);
}
return NULL;
}
diff --git a/modules/audio_output/jack.c b/modules/audio_output/jack.c
index e16986221a..1fda35e75c 100644
--- a/modules/audio_output/jack.c
+++ b/modules/audio_output/jack.c
@@ -339,7 +339,7 @@ static void Flush(audio_output_t *p_aout, bool wait)
{
vlc_tick_t delay;
if (!TimeGet(p_aout, &delay))
- msleep(delay);
+ vlc_tick_sleep(delay);
}
/* reset ringbuffer read and write pointers */
diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index f663bccba2..b475c0855d 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -184,7 +184,7 @@ static void Flush(audio_output_t *aout, bool drain)
if (drain) {
vlc_tick_t delay;
if (!TimeGet(aout, &delay))
- msleep(delay);
+ vlc_tick_sleep(delay);
} else {
vlc_mutex_lock(&sys->lock);
SetPlayState(sys->playerPlay, SL_PLAYSTATE_STOPPED);
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 560b9b891a..bc9f39be29 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -570,7 +570,7 @@ static void Flush(audio_output_t *aout, bool wait)
* See #18141: drain callback is never received */
vlc_tick_t delay;
if (TimeGet(aout, &delay) == 0 && delay <= INT64_C(5000000))
- msleep(delay);
+ vlc_tick_sleep(delay);
}
else
op = pa_stream_flush(s, NULL, NULL);
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 19f5cf2f20..e130914d00 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -197,7 +197,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
break; /* done */
/* Out of buffer space, sleep */
- msleep(sys->frames * (CLOCK_FREQ / 2) / sys->rate);
+ vlc_tick_sleep(sys->frames * (CLOCK_FREQ / 2) / sys->rate);
}
IAudioRenderClient_Release(render);
out:
diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index cdf38262d7..85ad9fbb13 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -370,7 +370,7 @@ static void Play( audio_output_t *p_aout, block_t *block, vlc_tick_t date )
{
msg_Warn( p_aout, "Couln't write frame... sleeping");
- msleep( block->i_length );
+ vlc_tick_sleep( block->i_length );
}
WaveOutClean( sys );
diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index a4415cbd2c..67b3fbe7b2 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -173,7 +173,7 @@ int va_pool_Get(va_pool_t *va_pool, picture_t *pic)
return VLC_ENOITEM;
/* Pool empty. Wait for some time as in src/input/decoder.c.
* XXX: Both this and the core should use a semaphore or a CV. */
- msleep(VOUT_OUTMEM_SLEEP);
+ vlc_tick_sleep(VOUT_OUTMEM_SLEEP);
}
pic->context = field;
return VLC_SUCCESS;
diff --git a/modules/codec/gstreamer/gstdecode.c b/modules/codec/gstreamer/gstdecode.c
index db0f978d25..312480ac89 100644
--- a/modules/codec/gstreamer/gstdecode.c
+++ b/modules/codec/gstreamer/gstdecode.c
@@ -112,7 +112,7 @@ void gst_vlc_dec_ensure_empty_queue( decoder_t *p_dec )
while( p_sys->b_running && i_count < 60 &&
gst_atomic_queue_length( p_sys->p_que ))
{
- msleep ( 15000 );
+ vlc_tick_sleep ( 15000 );
i_count++;
}
diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index 0521cb24d0..f8fb2e7e59 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -835,7 +835,7 @@ static async_task_t *encode_frame(encoder_t *enc, picture_t *pic)
if (sys->busy_warn_counter++ % 16 == 0)
msg_Dbg(enc, "Device is busy, let's wait and retry %d", sts);
if (sts == MFX_WRN_DEVICE_BUSY)
- msleep(QSV_BUSYWAIT_TIME);
+ vlc_tick_sleep(QSV_BUSYWAIT_TIME);
}
// msg_Dbg(enc, "Encode async status: %d, Syncpoint = %tx", sts, (ptrdiff_t)task->syncp);
diff --git a/modules/control/motion.c b/modules/control/motion.c
index 7491cadb9c..11a48e1898 100644
--- a/modules/control/motion.c
+++ b/modules/control/motion.c
@@ -137,7 +137,7 @@ static void *RunIntf( void *data )
/* Wait a bit, get orientation, change filter if necessary */
#warning FIXME: check once (or less) per picture, not once per interval
- msleep( INTF_IDLE_SLEEP );
+ vlc_tick_sleep( INTF_IDLE_SLEEP );
int canc = vlc_savecancel();
int i_x = motion_get_angle( p_intf->p_sys->p_motion );
diff --git a/modules/control/netsync.c b/modules/control/netsync.c
index 2a6a1a6a2b..ea59856a62 100644
--- a/modules/control/netsync.c
+++ b/modules/control/netsync.c
@@ -268,7 +268,7 @@ static void *Slave(void *handle)
vlc_restorecancel(canc);
}
wait:
- msleep(INTF_IDLE_SLEEP);
+ vlc_tick_sleep(INTF_IDLE_SLEEP);
}
return NULL;
}
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 12e2b05b70..2c9c2728e3 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1859,7 +1859,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
return ReadWin32( p_intf, (unsigned char*)p_buffer, pi_size );
else if( p_intf->p_sys->i_socket == -1 )
{
- msleep( INTF_IDLE_SLEEP );
+ vlc_tick_sleep( INTF_IDLE_SLEEP );
return false;
}
#endif
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 657136a775..1de276b38c 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -300,7 +300,7 @@ void PlaylistManager::drain()
if(b_drained)
break;
- msleep(20*1000); /* ugly, but we have no way to get feedback */
+ vlc_tick_sleep(20*1000); /* ugly, but we have no way to get feedback */
}
es_out_Control(p_demux->out, ES_OUT_RESET_PCR);
}
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 93bb4fd2f9..55d265174d 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1186,7 +1186,7 @@ static int Demux_Seekable( demux_t *p_demux )
* affect the reading speed too much. */
if( !(++i_loop_count % 1024) )
{
- msleep( VLC_HARD_MIN_SLEEP );
+ vlc_tick_sleep( VLC_HARD_MIN_SLEEP );
if( !(i_loop_count % (1024 * 10)) )
msg_Warn( p_demux,
@@ -1919,7 +1919,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux, unsigned int i_stream )
* affect the reading speed too much. */
if( !(++i_loop_count % 1024) )
{
- msleep( VLC_HARD_MIN_SLEEP );
+ vlc_tick_sleep( VLC_HARD_MIN_SLEEP );
if( !(i_loop_count % (1024 * 10)) )
msg_Warn( p_demux, "don't seem to find any data..." );
@@ -2338,7 +2338,7 @@ static int AVI_PacketSearch( demux_t *p_demux )
* this code is called only on broken files). */
if( !(++i_count % 1024) )
{
- msleep( VLC_HARD_MIN_SLEEP );
+ vlc_tick_sleep( VLC_HARD_MIN_SLEEP );
if( !(i_count % (1024 * 10)) )
msg_Warn( p_demux, "trying to resync..." );
}
diff --git a/modules/demux/mp4/heif.c b/modules/demux/mp4/heif.c
index 5de5415874..f841df3299 100644
--- a/modules/demux/mp4/heif.c
+++ b/modules/demux/mp4/heif.c
@@ -223,7 +223,7 @@ static int DemuxHEIF( demux_t *p_demux )
es_out_Control( p_demux->out, ES_OUT_GET_EMPTY, &b_empty );
if( !b_empty || mdate() <= p_sys->i_end_display_time )
{
- msleep( 40 * 1000 );
+ vlc_tick_sleep( 40 * 1000 );
return VLC_DEMUXER_SUCCESS;
}
p_sys->i_end_display_time = 0;
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 2f28f167a5..ecaa18c2aa 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -100,7 +100,7 @@ static int Lock(vlc_va_t *va, picture_t *pic, uint8_t **data)
return VLC_ENOMEM;
/* Pool empty. Wait for some time as in src/input/decoder.c.
* XXX: Both this and the core should use a semaphore or a CV. */
- msleep(VOUT_OUTMEM_SLEEP);
+ vlc_tick_sleep(VOUT_OUTMEM_SLEEP);
}
pic->context = &field->context;
diff --git a/modules/misc/fingerprinter.c b/modules/misc/fingerprinter.c
index 2c827665af..58d12cfa47 100644
--- a/modules/misc/fingerprinter.c
+++ b/modules/misc/fingerprinter.c
@@ -336,7 +336,7 @@ static void *Run( void *opaque )
/* main loop */
for (;;)
{
- msleep( CLOCK_FREQ );
+ vlc_tick_sleep( CLOCK_FREQ );
QueueIncomingRequests( p_sys );
diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c
index 8f52d31809..5892a81d72 100644
--- a/modules/services_discovery/mtp.c
+++ b/modules/services_discovery/mtp.c
@@ -166,11 +166,11 @@ static void *Run( void *data )
vlc_restorecancel(canc);
if( i_status == 2 )
{
- msleep( 5*CLOCK_FREQ );
+ vlc_tick_sleep( 5*CLOCK_FREQ );
i_status = 0;
}
else
- msleep( CLOCK_FREQ/2 );
+ vlc_tick_sleep( CLOCK_FREQ/2 );
}
return NULL;
}
diff --git a/modules/spu/remoteosd.c b/modules/spu/remoteosd.c
index 85366d932d..e1ec87495a 100644
--- a/modules/spu/remoteosd.c
+++ b/modules/spu/remoteosd.c
@@ -710,7 +710,7 @@ static void* update_request_thread( void *obj )
interval *= 1000; /* ms -> µs */
do
- msleep( interval );
+ vlc_tick_sleep( interval );
while( write_update_request( p_filter, true ) );
return NULL;
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index 3a6d5a227b..88c560ddb4 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -302,7 +302,7 @@ static decklink_sys_t *HoldDLSys(vlc_object_t *obj, int i_cat)
{
vlc_mutex_unlock(&sys_lock);
msg_Info(obj, "Waiting for previous vout module to exit");
- msleep(CLOCK_FREQ / 10);
+ vlc_tick_sleep(CLOCK_FREQ / 10);
vlc_mutex_lock(&sys_lock);
}
}
@@ -1094,7 +1094,7 @@ static void Flush (audio_output_t *aout, bool drain)
if (drain) {
uint32_t samples;
sys->p_output->GetBufferedAudioSampleFrameCount(&samples);
- msleep(CLOCK_FREQ * samples / sys->i_rate);
+ vlc_tick_sleep(CLOCK_FREQ * samples / sys->i_rate);
} else if (sys->p_output->FlushBufferedAudioSamples() == E_FAIL)
msg_Err(aout, "Flush failed");
}
diff --git a/src/darwin/thread.c b/src/darwin/thread.c
index 56fcdc5ddb..814517013b 100644
--- a/src/darwin/thread.c
+++ b/src/darwin/thread.c
@@ -541,11 +541,11 @@ void vlc_tick_wait (vlc_tick_t deadline)
{
deadline -= mdate ();
if (deadline > 0)
- msleep (deadline);
+ vlc_tick_sleep (deadline);
}
-#undef msleep
-void msleep (vlc_tick_t delay)
+#undef vlc_tick_sleep
+void vlc_tick_sleep (vlc_tick_t delay)
{
struct timespec ts = mtime_to_ts (delay);
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 862c0447e6..ef8a1a469f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -581,7 +581,7 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
if( p_vout )
break;
- msleep( DECODER_SPU_VOUT_WAIT_DURATION );
+ vlc_tick_sleep( DECODER_SPU_VOUT_WAIT_DURATION );
}
if( !p_vout )
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 3649fbed96..28a47d79f8 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2155,7 +2155,7 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
break;
/* FIXME there should be a way to have auto deleted es, but there will be
* a problem when another codec of the same type is created (mainly video) */
- msleep( CLOCK_FREQ/50 );
+ vlc_tick_sleep( CLOCK_FREQ/50 );
}
EsUnselect( out, es, es->p_pgrm == p_sys->p_pgrm );
}
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index eb1e32b5ed..05008ba723 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -271,7 +271,7 @@ vlc_obj_malloc
vlc_obj_calloc
vlc_obj_strdup
vlc_obj_free
-msleep
+vlc_tick_sleep
vlc_tick_wait
net_Accept
net_AcceptSingle
diff --git a/src/misc/threads.c b/src/misc/threads.c
index 97e35b95a1..f76da8d3a2 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -96,7 +96,7 @@ void (vlc_tick_wait)(vlc_tick_t deadline)
vlc_cancel_addr_finish(&value);
}
-void (msleep)(vlc_tick_t delay)
+void (vlc_tick_sleep)(vlc_tick_t delay)
{
vlc_tick_wait(mdate() + delay);
}
diff --git a/src/os2/thread.c b/src/os2/thread.c
index 91751ce747..8c07c5fe5b 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -929,8 +929,8 @@ void vlc_tick_wait (vlc_tick_t deadline)
}
}
-#undef msleep
-void msleep (vlc_tick_t delay)
+#undef vlc_tick_sleep
+void vlc_tick_sleep (vlc_tick_t delay)
{
vlc_tick_wait (mdate () + delay);
}
diff --git a/src/posix/thread.c b/src/posix/thread.c
index a3567054fa..d0c8318098 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -604,8 +604,8 @@ void vlc_tick_wait (vlc_tick_t deadline)
while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL) == EINTR);
}
-#undef msleep
-void msleep (vlc_tick_t delay)
+#undef vlc_tick_sleep
+void vlc_tick_sleep (vlc_tick_t delay)
{
struct timespec ts = mtime_to_ts (delay);
diff --git a/src/test/timer.c b/src/test/timer.c
index d789d5005c..1f5007cdf4 100644
--- a/src/test/timer.c
+++ b/src/test/timer.c
@@ -28,7 +28,7 @@
#include <assert.h>
#include <vlc_common.h>
-#undef msleep
+#undef vlc_tick_sleep
struct timer_data
{
diff --git a/src/win32/thread.c b/src/win32/thread.c
index cb87eec778..f4ee5b65bf 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -793,7 +793,7 @@ void (vlc_tick_wait)(vlc_tick_t deadline)
}
}
-void (msleep)(vlc_tick_t delay)
+void (vlc_tick_sleep)(vlc_tick_t delay)
{
vlc_tick_wait (mdate () + delay);
}
diff --git a/test/libvlc/media.c b/test/libvlc/media.c
index eef9ece051..e69f0d7c64 100644
--- a/test/libvlc/media.c
+++ b/test/libvlc/media.c
@@ -163,7 +163,7 @@ static void test_input_metadata_timeout(libvlc_instance_t *vlc, int timeout,
if (wait_and_cancel > 0)
{
- msleep(wait_and_cancel * 1000);
+ vlc_tick_sleep(wait_and_cancel * 1000);
libvlc_MetadataCancel(vlc->p_libvlc_int, vlc);
}
diff --git a/test/libvlc/media_list_player.c b/test/libvlc/media_list_player.c
index f99f62e640..7156212a59 100644
--- a/test/libvlc/media_list_player.c
+++ b/test/libvlc/media_list_player.c
@@ -23,7 +23,7 @@
#include "test.h"
- // For msleep
+ // For vlc_tick_sleep
#include <vlc_common.h>
#include <vlc_tick.h>
diff --git a/test/src/interface/dialog.c b/test/src/interface/dialog.c
index 15f5c7aa85..bb1fe23286 100644
--- a/test/src/interface/dialog.c
+++ b/test/src/interface/dialog.c
@@ -207,7 +207,7 @@ test_dialogs(vlc_object_t *p_obj, struct cb_answer *p_ans,
"Indeterminate non cancellable dialog "
"for %" PRId64 " us", i_dialog_wait);
assert(p_id != NULL);
- msleep(i_dialog_wait);
+ vlc_tick_sleep(i_dialog_wait);
vlc_dialog_release(p_obj, p_id);
assert(i_ret == VLC_SUCCESS);
@@ -220,7 +220,7 @@ test_dialogs(vlc_object_t *p_obj, struct cb_answer *p_ans,
"Cancel It!");
assert(p_id != NULL);
while(!vlc_dialog_is_cancelled(p_obj, p_id))
- msleep(i_dialog_wait / 30);
+ vlc_tick_sleep(i_dialog_wait / 30);
vlc_dialog_release(p_obj, p_id);
set_answer(p_ans, false, NULL, 0);
@@ -229,7 +229,7 @@ test_dialogs(vlc_object_t *p_obj, struct cb_answer *p_ans,
assert(p_id != NULL);
while (f_position <= 1.0f)
{
- msleep(i_dialog_wait / 30);
+ vlc_tick_sleep(i_dialog_wait / 30);
f_position += 0.02f;
i_ret = vlc_dialog_update_progress(p_obj, p_id, f_position);
assert(i_ret == VLC_SUCCESS);
@@ -244,7 +244,7 @@ test_dialogs(vlc_object_t *p_obj, struct cb_answer *p_ans,
assert(p_id != NULL);
while (f_position <= 1.0f)
{
- msleep(i_dialog_wait / 30);
+ vlc_tick_sleep(i_dialog_wait / 30);
f_position += 0.02f;
i_ret = vlc_dialog_update_progress_text(p_obj, p_id, f_position,
"Non cancellable dialog in progress.\n"
@@ -274,7 +274,7 @@ test_dialogs(vlc_object_t *p_obj, struct cb_answer *p_ans,
"Error");
assert(i_ret == 0);
while(!vlc_dialog_is_cancelled(p_obj, p_id))
- msleep(i_dialog_wait / 30);
+ vlc_tick_sleep(i_dialog_wait / 30);
vlc_dialog_release(p_obj, p_id);
}
--
2.17.0
More information about the vlc-devel
mailing list