Ignore:
Timestamp:
03/09/18 16:46:26 (4 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, etsilive, master, rc-4.0.4, ringdecrementfix, ringperformance
Children:
7c33187
Parents:
62ee4ec
Message:

Add packet reference counting API

This API allows users to keep track of references to libtrace
packet structures that are not being released by the per packet
processing threads, e.g. those passed to the reporter or to
any user-created pthreads.

If you only have one reference to a packet at any given time,
you won't need this API. However, if you have multiple
concurrent references, this API will allow you to ensure that the
packet is correctly freed only once all references have been
finished with.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace_parallel.h

    r5c07bfe rc1205bd  
    12721272DLLEXPORT void trace_free_packet(libtrace_t * libtrace, libtrace_packet_t * packet);
    12731273
     1274/** Increments the internal reference counter for a packet.
     1275 * @param packet        The packet opaque pointer
     1276 *
     1277 * You may wish to use this function (and its decrementing counterpart)
     1278 * in situations where you are retaining multiple references to a packet
     1279 * outside of the core packet processing function. This will ensure that
     1280 * the packet is not released until there are no more outstanding references
     1281 * to the packet anywhere in your program.
     1282 */
     1283DLLEXPORT void trace_increment_packet_refcount(libtrace_packet_t *packet);
     1284
     1285/** Decrements the internal reference counter for a packet.
     1286 * @param packet        The packet opaque pointer
     1287 *
     1288 * If the reference counter goes below one, trace_fin_packet() will be
     1289 * called on the packet.
     1290 *
     1291 * You may wish to use this function (and its incrementing counterpart)
     1292 * in situations where you are retaining multiple references to a packet
     1293 * outside of the core packet processing function. This will ensure that
     1294 * the packet is not released until there are no more outstanding references
     1295 * to the packet anywhere in your program.
     1296 */
     1297DLLEXPORT void trace_decrement_packet_refcount(libtrace_packet_t *packet);
     1298
     1299
    12741300/** Provides some basic information about a trace based on its input format.
    12751301 *
Note: See TracChangeset for help on using the changeset viewer.