Ignore:
Timestamp:
03/06/15 09:35:51 (6 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
4ce6fca
Parents:
ab3fa18
Message:

Move parallel API functions to libtrace_parallel.h

Also started the process of updating the documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace_parallel.c

    rab3fa18 r6a082f8  
    13261326 * Verifies the configuration and sets default values for any values not
    13271327 * specified by the user.
    1328  * @return
    13291328 */
    13301329static void verify_configuration(libtrace_t *libtrace) {
     
    14961495}
    14971496
    1498 /* Start an input trace in the parallel libtrace framework.
    1499  * This can also be used to restart an existing parallel.
    1500  *
    1501  * NOTE: libtrace lock is held for the majority of this function
    1502  *
    1503  * @param libtrace the input trace to start
    1504  * @param global_blob some global data you can share with the new perpkt threads
    1505  * @returns 0 on success, otherwise -1 to indicate an error has occured
    1506  */
    15071497DLLEXPORT int trace_pstart(libtrace_t *libtrace, void* global_blob,
    15081498                           fn_per_pkt per_pkt, fn_reporter reporter) {
     
    20952085}
    20962086
    2097 DLLEXPORT void * trace_get_global(libtrace_t *trace)
     2087DLLEXPORT void * trace_get_local(libtrace_t *trace)
    20982088{
    20992089        return trace->global_blob;
    21002090}
    21012091
    2102 DLLEXPORT void * trace_set_global(libtrace_t *trace, void * data)
     2092DLLEXPORT void * trace_set_local(libtrace_t *trace, void * data)
    21032093{
    21042094        void *ret;
    2105         pthread_mutex_lock(trace->libtrace_lock);
     2095        pthread_mutex_lock(&trace->libtrace_lock);
    21062096        ret = trace->global_blob;
    21072097        trace->global_blob = data;
    2108         pthread_mutex_unlock(trace->libtrace_lock);
     2098        pthread_mutex_unlock(&trace->libtrace_lock);
    21092099        return ret;
    21102100}
     
    21172107DLLEXPORT void * trace_set_tls(libtrace_thread_t *t, void * data)
    21182108{
    2119         if(t->user_data && t->user_data != data) {
    2120                 void *ret = t->user_data;
    2121                 t->user_data = data;
    2122                 return ret;
    2123         } else {
    2124                 t->user_data = data;
    2125                 return NULL;
    2126         }
     2109        void *ret = t->user_data;
     2110        t->user_data = data;
     2111        return ret;
    21272112}
    21282113
     
    21412126}
    21422127
    2143 /**
    2144  * Sets a combiner function against the trace.
    2145  */
    21462128DLLEXPORT void trace_set_combiner(libtrace_t *trace, const libtrace_combine_t *combiner, libtrace_generic_t config){
    21472129        if (combiner) {
Note: See TracChangeset for help on using the changeset viewer.