MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_fifo_get_wait

Function hb_fifo_get_wait

libhb/fifo.c:1269–1296  ·  view source on GitHub ↗

Pulls the first packet out of this FIFO, blocking until such a packet is available. Returns NULL if this FIFO has been closed or flushed.

Source from the content-addressed store, hash-verified

1267// Pulls the first packet out of this FIFO, blocking until such a packet is available.
1268// Returns NULL if this FIFO has been closed or flushed.
1269hb_buffer_t * hb_fifo_get_wait( hb_fifo_t * f )
1270{
1271 hb_buffer_t * b;
1272
1273 hb_lock( f->lock );
1274 if( f->size < 1 )
1275 {
1276 f->wait_empty = 1;
1277 hb_cond_timedwait( f->cond_empty, f->lock, FIFO_TIMEOUT );
1278 if( f->size < 1 )
1279 {
1280 hb_unlock( f->lock );
1281 return NULL;
1282 }
1283 }
1284 b = f->first;
1285 f->first = b->next;
1286 b->next = NULL;
1287 f->size -= 1;
1288 if( f->wait_full && f->size == f->capacity - f->thresh )
1289 {
1290 f->wait_full = 0;
1291 hb_cond_signal( f->cond_full );
1292 }
1293 hb_unlock( f->lock );
1294
1295 return b;
1296}
1297
1298// Pulls a packet out of this FIFO, or returns NULL if no packet is available.
1299hb_buffer_t * hb_fifo_get( hb_fifo_t * f )

Callers 4

process_filterFunction · 0.85
hb_work_loopFunction · 0.85
filter_loopFunction · 0.85
process_filterFunction · 0.85

Calls 4

hb_lockFunction · 0.85
hb_cond_timedwaitFunction · 0.85
hb_unlockFunction · 0.85
hb_cond_signalFunction · 0.85

Tested by

no test coverage detected