]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/liblfds710/src/lfds710_queue_bounded_manyproducer_manyconsumer/lfds710_queue_bounded_manyproducer_manyconsumer_cleanup.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / liblfds710 / src / lfds710_queue_bounded_manyproducer_manyconsumer / lfds710_queue_bounded_manyproducer_manyconsumer_cleanup.c
1 /***** includes *****/
2 #include "lfds710_queue_bounded_manyproducer_manyconsumer_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 void lfds710_queue_bmm_cleanup( struct lfds710_queue_bmm_state *qbmms,
10                                 void (*element_cleanup_callback)(struct lfds710_queue_bmm_state *qbmms, void *key, void *value) )
11 {
12   void
13     *key,
14     *value;
15
16   LFDS710_PAL_ASSERT( qbmms != NULL );
17   // TRD : element_cleanup_callback can be NULL
18
19   LFDS710_MISC_BARRIER_LOAD;
20
21   if( element_cleanup_callback != NULL )
22     while( lfds710_queue_bmm_dequeue(qbmms,&key,&value) )
23       element_cleanup_callback( qbmms, key, value );
24
25   return;
26 }
27