Appends the specified packet list to the end of the specified FIFO.
| 1434 | |
| 1435 | // Appends the specified packet list to the end of the specified FIFO. |
| 1436 | void hb_fifo_push( hb_fifo_t * f, hb_buffer_t * b ) |
| 1437 | { |
| 1438 | if( !b ) |
| 1439 | { |
| 1440 | return; |
| 1441 | } |
| 1442 | |
| 1443 | hb_lock( f->lock ); |
| 1444 | if (f->size >= f->capacity && |
| 1445 | f->cond_alert_full != NULL) |
| 1446 | { |
| 1447 | hb_cond_broadcast( f->cond_alert_full ); |
| 1448 | } |
| 1449 | if( f->size > 0 ) |
| 1450 | { |
| 1451 | f->last->next = b; |
| 1452 | } |
| 1453 | else |
| 1454 | { |
| 1455 | f->first = b; |
| 1456 | } |
| 1457 | f->last = b; |
| 1458 | f->size += 1; |
| 1459 | while( f->last->next ) |
| 1460 | { |
| 1461 | f->size += 1; |
| 1462 | f->last = f->last->next; |
| 1463 | } |
| 1464 | if( f->wait_empty && f->size >= 1 ) |
| 1465 | { |
| 1466 | f->wait_empty = 0; |
| 1467 | hb_cond_signal( f->cond_empty ); |
| 1468 | } |
| 1469 | hb_unlock( f->lock ); |
| 1470 | } |
| 1471 | |
| 1472 | // Prepends the specified packet list to the start of the specified FIFO. |
| 1473 | void hb_fifo_push_head( hb_fifo_t * f, hb_buffer_t * b ) |
no test coverage detected