[vlc-devel] [PATCH 4/6] rename mwait() to vlc_tick_wait()

Steve Lhomme robux4 at ycbcr.xyz
Wed Jun 20 08:54:34 CEST 2018


---
 include/vlc_interrupt.h            | 2 +-
 include/vlc_threads.h              | 8 ++++----
 modules/access/rdp.c               | 2 +-
 modules/access/screen/screen.c     | 2 +-
 modules/access/vnc.c               | 2 +-
 modules/access_output/udp.c        | 2 +-
 modules/demux/image.c              | 2 +-
 modules/demux/mjpeg.c              | 2 +-
 modules/misc/audioscrobbler.c      | 2 +-
 modules/stream_filter/hds/hds.c    | 2 +-
 modules/stream_out/rtp.c           | 4 ++--
 modules/visualization/glspectrum.c | 2 +-
 modules/visualization/projectm.cpp | 2 +-
 src/darwin/thread.c                | 4 ++--
 src/input/es_out_timeshift.c       | 2 +-
 src/libvlccore.sym                 | 2 +-
 src/misc/interrupt.c               | 2 +-
 src/misc/threads.c                 | 4 ++--
 src/os2/thread.c                   | 6 +++---
 src/posix/thread.c                 | 4 ++--
 src/video_output/video_output.c    | 2 +-
 src/win32/thread.c                 | 4 ++--
 22 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/include/vlc_interrupt.h b/include/vlc_interrupt.h
index 863a15eb38..20ae7e832c 100644
--- a/include/vlc_interrupt.h
+++ b/include/vlc_interrupt.h
@@ -61,7 +61,7 @@ struct msghdr;
 VLC_API int vlc_sem_wait_i11e(vlc_sem_t *);
 
 /**
- * Interruptible variant of mwait().
+ * Interruptible variant of vlc_tick_wait().
  *
  * Waits for a specified timestamp or, if the calling thread has an
  * interruption context, an interruption.
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 2a4b36e9c3..46e8fd53b1 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -521,7 +521,7 @@ VLC_API void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex);
  *
  * This works like vlc_cond_wait() but with an additional time-out.
  * The time-out is expressed as an absolute timestamp using the same arbitrary
- * time reference as the mdate() and mwait() functions.
+ * time reference as the mdate() and vlc_tick_wait() functions.
  *
  * \note This function is a cancellation point. In case of thread cancellation,
  * the mutex is always locked before cancellation proceeds.
@@ -832,7 +832,7 @@ VLC_API unsigned long vlc_thread_id(void) VLC_USED;
  * Precision monotonic clock.
  *
  * 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 mwait() or
+ * 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
  * only 100 to 1000 Hz.
  *
@@ -852,7 +852,7 @@ VLC_API vlc_tick_t mdate(void);
  * \note The deadline may be exceeded due to OS scheduling.
  * \note This function is a cancellation point.
  */
-VLC_API void mwait(vlc_tick_t deadline);
+VLC_API void vlc_tick_wait(vlc_tick_t deadline);
 
 /**
  * Waits for an interval of time.
@@ -918,7 +918,7 @@ vlc_tick_t impossible_deadline( vlc_tick_t deadline )
 #endif
 
 #define msleep(d) msleep(check_delay(d))
-#define mwait(d) mwait(check_deadline(d))
+#define vlc_tick_wait(d) vlc_tick_wait(check_deadline(d))
 
 /**
  * Initializes an asynchronous timer.
diff --git a/modules/access/rdp.c b/modules/access/rdp.c
index 6188618e27..4e33414c01 100644
--- a/modules/access/rdp.c
+++ b/modules/access/rdp.c
@@ -396,7 +396,7 @@ static void *DemuxThread( void *p_data )
             vlc_restorecancel( p_sys->i_cancel_state );
         }
 
-        mwait( i_next_frame_date );
+        vlc_tick_wait( i_next_frame_date );
         i_next_frame_date += p_sys->i_frame_interval;
 
         if ( i_ret >= 0 )
diff --git a/modules/access/screen/screen.c b/modules/access/screen/screen.c
index 13d8fce812..5453ef7f8a 100644
--- a/modules/access/screen/screen.c
+++ b/modules/access/screen/screen.c
@@ -281,7 +281,7 @@ static int Demux( demux_t *p_demux )
     while( mdate() >= p_sys->i_next_date + p_sys->i_incr )
         p_sys->i_next_date += p_sys->i_incr;
 
-    mwait( p_sys->i_next_date );
+    vlc_tick_wait( p_sys->i_next_date );
     p_block = screen_Capture( p_demux );
     if( !p_block )
     {
diff --git a/modules/access/vnc.c b/modules/access/vnc.c
index 12d9b3cbc3..57dbfb6955 100644
--- a/modules/access/vnc.c
+++ b/modules/access/vnc.c
@@ -348,7 +348,7 @@ static void *DemuxThread( void *p_data )
 
         /* Ensure we're not building frames too fast */
         /* as WaitForMessage takes only a maximum wait */
-        mwait( i_next_frame_date );
+        vlc_tick_wait( i_next_frame_date );
         i_next_frame_date += p_sys->i_frame_interval;
 
         if ( i_status > 0 )
diff --git a/modules/access_output/udp.c b/modules/access_output/udp.c
index 0818b21cf3..91a052ae3e 100644
--- a/modules/access_output/udp.c
+++ b/modules/access_output/udp.c
@@ -425,7 +425,7 @@ static void* ThreadWrite( void *data )
         i_to_send--;
         if( !i_to_send || (p_pk->i_flags & BLOCK_FLAG_CLOCK) )
         {
-            mwait( i_date );
+            vlc_tick_wait( i_date );
             i_to_send = i_group;
         }
         if ( send( p_sys->i_handle, p_pk->p_buffer, p_pk->i_buffer, 0 ) == -1 )
diff --git a/modules/demux/image.c b/modules/demux/image.c
index 7c63a19afe..b9c92d9b02 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -200,7 +200,7 @@ static int Demux(demux_t *demux)
         if (deadline + max_wait < pts_first) {
             es_out_SetPCR(demux->out, deadline);
             /* That's ugly, but not yet easily fixable */
-            mwait(deadline + max_wait);
+            vlc_tick_wait(deadline + max_wait);
             return VLC_DEMUXER_SUCCESS;
         }
     } else {
diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index 0726649c78..17a9aa73af 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -403,7 +403,7 @@ static int MjpgDemux( demux_t *p_demux )
     if( p_sys->b_still && p_sys->i_still_end )
     {
         /* Still frame, wait until the pause delay is gone */
-        mwait( p_sys->i_still_end );
+        vlc_tick_wait( p_sys->i_still_end );
         p_sys->i_still_end = 0;
         return VLC_DEMUXER_SUCCESS;
     }
diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c
index f55725f6e7..0dcd5e9dd9 100644
--- a/modules/misc/audioscrobbler.c
+++ b/modules/misc/audioscrobbler.c
@@ -684,7 +684,7 @@ static void *Run(void *data)
     for (;;)
     {
         vlc_restorecancel(canc);
-        mwait(next_exchange);
+        vlc_tick_wait(next_exchange);
 
         vlc_mutex_lock(&p_sys->lock);
         mutex_cleanup_push(&p_sys->lock);
diff --git a/modules/stream_filter/hds/hds.c b/modules/stream_filter/hds/hds.c
index aac96d4492..f498aa4d36 100644
--- a/modules/stream_filter/hds/hds.c
+++ b/modules/stream_filter/hds/hds.c
@@ -1167,7 +1167,7 @@ static void* live_thread( void* p )
             vlc_stream_Delete( download_stream );
         }
 
-        mwait( last_dl_start_time + ( ((int64_t)hds_stream->fragment_runs[hds_stream->fragment_run_count-1].fragment_duration) * 1000000LL) / ((int64_t)hds_stream->afrt_timescale) );
+        vlc_tick_wait( last_dl_start_time + ( ((int64_t)hds_stream->fragment_runs[hds_stream->fragment_run_count-1].fragment_duration) * 1000000LL) / ((int64_t)hds_stream->afrt_timescale) );
 
 
     }
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 269964bc30..7d60f63d7f 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1425,12 +1425,12 @@ static void* ThreadSend( void *data )
                 out->i_buffer = len;
         }
         if (out)
-            mwait (out->i_dts + i_caching);
+            vlc_tick_wait (out->i_dts + i_caching);
         vlc_cleanup_pop ();
         if (out == NULL)
             continue;
 #else
-        mwait (out->i_dts + i_caching);
+        vlc_tick_wait (out->i_dts + i_caching);
         vlc_cleanup_pop ();
 #endif
 
diff --git a/modules/visualization/glspectrum.c b/modules/visualization/glspectrum.c
index a6c4579d62..84fad8f036 100644
--- a/modules/visualization/glspectrum.c
+++ b/modules/visualization/glspectrum.c
@@ -487,7 +487,7 @@ static void *Thread( void *p_data )
         glPopMatrix();
 
         /* Wait to swapp the frame on time. */
-        mwait(block->i_pts + (block->i_length / 2));
+        vlc_tick_wait(block->i_pts + (block->i_length / 2));
         vlc_gl_Swap(gl);
 
 release:
diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp
index d2f0e6fac6..60c27e9b1f 100644
--- a/modules/visualization/projectm.cpp
+++ b/modules/visualization/projectm.cpp
@@ -373,7 +373,7 @@ static void *Thread( void *p_data )
         p_projectm->renderFrame();
 
         /* */
-        mwait( i_deadline );
+        vlc_tick_wait( i_deadline );
 
         vlc_gl_Swap( gl );
     }
diff --git a/src/darwin/thread.c b/src/darwin/thread.c
index 3a906af4fc..56fcdc5ddb 100644
--- a/src/darwin/thread.c
+++ b/src/darwin/thread.c
@@ -536,8 +536,8 @@ vlc_tick_t mdate (void)
     return (d.quot * date) + ((d.rem * date) / denom);
 }
 
-#undef mwait
-void mwait (vlc_tick_t deadline)
+#undef vlc_tick_wait
+void vlc_tick_wait (vlc_tick_t deadline)
 {
     deadline -= mdate ();
     if (deadline > 0)
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index c51287d711..65972440be 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -1044,7 +1044,7 @@ static void *TsRun( void *p_data )
          * reading  */
         vlc_cleanup_push( cmd_cleanup_routine, &cmd );
 
-        mwait( i_deadline );
+        vlc_tick_wait( i_deadline );
 
         vlc_cleanup_pop();
 
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index e32a686da4..eb1e32b5ed 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -272,7 +272,7 @@ vlc_obj_calloc
 vlc_obj_strdup
 vlc_obj_free
 msleep
-mwait
+vlc_tick_wait
 net_Accept
 net_AcceptSingle
 net_Connect
diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c
index 24f59ebfb7..d2a04a72b3 100644
--- a/src/misc/interrupt.c
+++ b/src/misc/interrupt.c
@@ -229,7 +229,7 @@ int vlc_mwait_i11e(vlc_tick_t deadline)
 {
     vlc_interrupt_t *ctx = vlc_interrupt_var;
     if (ctx == NULL)
-        return mwait(deadline), 0;
+        return vlc_tick_wait(deadline), 0;
 
     vlc_cond_t wait;
     vlc_cond_init(&wait);
diff --git a/src/misc/threads.c b/src/misc/threads.c
index cf42ceb4e2..97e35b95a1 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -80,7 +80,7 @@ static void vlc_cancel_addr_finish(void *addr)
 #endif
 
 #ifdef LIBVLC_NEED_SLEEP
-void (mwait)(vlc_tick_t deadline)
+void (vlc_tick_wait)(vlc_tick_t deadline)
 {
     vlc_tick_t delay;
     atomic_int value = ATOMIC_VAR_INIT(0);
@@ -98,7 +98,7 @@ void (mwait)(vlc_tick_t deadline)
 
 void (msleep)(vlc_tick_t delay)
 {
-    mwait(mdate() + delay);
+    vlc_tick_wait(mdate() + delay);
 }
 #endif
 
diff --git a/src/os2/thread.c b/src/os2/thread.c
index a01452f018..91751ce747 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -913,8 +913,8 @@ vlc_tick_t mdate (void)
     return (d.quot * CLOCK_FREQ) + ((d.rem * CLOCK_FREQ) / freq);
 }
 
-#undef mwait
-void mwait (vlc_tick_t deadline)
+#undef vlc_tick_wait
+void vlc_tick_wait (vlc_tick_t deadline)
 {
     vlc_tick_t delay;
 
@@ -932,7 +932,7 @@ void mwait (vlc_tick_t deadline)
 #undef msleep
 void msleep (vlc_tick_t delay)
 {
-    mwait (mdate () + delay);
+    vlc_tick_wait (mdate () + delay);
 }
 
 /*** Timers ***/
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 2781bd8245..a3567054fa 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -589,8 +589,8 @@ vlc_tick_t mdate (void)
     return (INT64_C(1000000) * ts.tv_sec) + (ts.tv_nsec / 1000);
 }
 
-#undef mwait
-void mwait (vlc_tick_t deadline)
+#undef vlc_tick_wait
+void vlc_tick_wait (vlc_tick_t deadline)
 {
     static pthread_once_t vlc_clock_once = PTHREAD_ONCE_INIT;
 
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 3f115b5b64..09e5d55337 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1157,7 +1157,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
         msg_Warn(vout, "picture is late (%lld ms)", delay / 1000);
 #endif
     if (!is_forced)
-        mwait(todisplay->date);
+        vlc_tick_wait(todisplay->date);
 
     /* Display the direct buffer returned by vout_RenderPicture */
     vout->p->displayed.date = mdate();
diff --git a/src/win32/thread.c b/src/win32/thread.c
index a96d6b64c0..cb87eec778 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -777,7 +777,7 @@ vlc_tick_t mdate (void)
 }
 
 #if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-void (mwait)(vlc_tick_t deadline)
+void (vlc_tick_wait)(vlc_tick_t deadline)
 {
     vlc_tick_t delay;
 
@@ -795,7 +795,7 @@ void (mwait)(vlc_tick_t deadline)
 
 void (msleep)(vlc_tick_t delay)
 {
-    mwait (mdate () + delay);
+    vlc_tick_wait (mdate () + delay);
 }
 #endif
 
-- 
2.17.0



More information about the vlc-devel mailing list