/***************************************************************************** * Deactivate: uninitialize and cleanup *****************************************************************************/ static void Deactivate( vlc_object_t *p_this ) { vlc_inhibit_t *p_ih = (vlc_inhibit_t*)p_this; vlc_inhibit_sys_t *p_sys = p_ih->p_sys; vlc_timer_destroy( p_sys->timer ); free( p_sys ); }
/** * Releases resources */ static void Close (vlc_object_t *obj) { demux_t *demux = (demux_t *)obj; demux_sys_t *p_sys = demux->p_sys; vlc_timer_destroy (p_sys->timer); xcb_disconnect (p_sys->conn); free (p_sys); }
static void Close (vlc_object_t *obj) { vlc_inhibit_t *ih = (vlc_inhibit_t *)obj; vlc_inhibit_sys_t *p_sys = ih->p_sys; vlc_timer_destroy (p_sys->timer); posix_spawnattr_destroy (&p_sys->attr); free (p_sys); }
/***************************************************************************** * DestroyFilter: destroy RSS video filter *****************************************************************************/ static void DestroyFilter( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys = p_filter->p_sys; vlc_timer_destroy( p_sys->timer ); vlc_mutex_destroy( &p_sys->lock ); text_style_Delete( p_sys->p_style ); free( p_sys->psz_marquee ); FreeRSS( p_sys->p_feeds, p_sys->i_feeds ); free( p_sys ); }
void RtspUnsetup( rtsp_stream_t *rtsp ) { if( rtsp->url ) httpd_UrlDelete( rtsp->url ); if( rtsp->host ) httpd_HostDelete( rtsp->host ); while( rtsp->sessionc > 0 ) RtspClientDel( rtsp, rtsp->sessionv[0] ); if (rtsp->timeout > 0) vlc_timer_destroy(rtsp->timer); free( rtsp->psz_path ); vlc_mutex_destroy( &rtsp->lock ); free( rtsp ); }
static void timer_cleanup (void *timer) { vlc_timer_destroy ((vlc_timer_t)timer); }
int main (void) { struct timer_data data; mtime_t ts; int val; vlc_mutex_init (&data.lock); vlc_cond_init (&data.wait); data.count = 0; val = vlc_timer_create (&data.timer, callback, &data); assert (val == 0); vlc_timer_destroy (data.timer); assert (data.count == 0); val = vlc_timer_create (&data.timer, callback, &data); assert (val == 0); vlc_timer_schedule (data.timer, false, CLOCK_FREQ << 20, CLOCK_FREQ); vlc_timer_destroy (data.timer); assert (data.count == 0); val = vlc_timer_create (&data.timer, callback, &data); assert (val == 0); /* Relative timer */ ts = mdate (); vlc_timer_schedule (data.timer, false, 1, CLOCK_FREQ / 100); vlc_mutex_lock (&data.lock); while (data.count <= 10) vlc_cond_wait(&data.wait, &data.lock); ts = mdate () - ts; printf ("%u iterations in %"PRId64" us\n", data.count, ts); data.count = 0; vlc_mutex_unlock (&data.lock); assert(ts >= (CLOCK_FREQ / 10)); vlc_timer_schedule (data.timer, false, 0, 0); /* Absolute timer */ ts = mdate (); vlc_timer_schedule (data.timer, true, ts + CLOCK_FREQ / 10, CLOCK_FREQ / 100); vlc_mutex_lock (&data.lock); while (data.count <= 10) vlc_cond_wait(&data.wait, &data.lock); ts = mdate () - ts; printf ("%u iterations in %"PRId64" us\n", data.count, ts); vlc_mutex_unlock (&data.lock); assert(ts >= (CLOCK_FREQ / 5)); vlc_timer_destroy (data.timer); vlc_cond_destroy (&data.wait); vlc_mutex_destroy (&data.lock); return 0; }