Changeset ab3fa18


Ignore:
Timestamp:
03/05/15 19:27:46 (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:
6a082f8
Parents:
62b3c4e
git-author:
Richard Sanger <rsangerarj@…> (03/05/15 19:16:08)
git-committer:
Richard Sanger <rsangerarj@…> (03/05/15 19:27:46)
Message:

Make trace_set_global thread-safe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace_parallel.c

    r62b3c4e rab3fa18  
    21022102DLLEXPORT void * trace_set_global(libtrace_t *trace, void * data)
    21032103{
    2104         if (trace->global_blob && trace->global_blob != data) {
    2105                 void * ret = trace->global_blob;
    2106                 trace->global_blob = data;
    2107                 return ret;
    2108         } else {
    2109                 trace->global_blob = data;
    2110                 return NULL;
    2111         }
     2104        void *ret;
     2105        pthread_mutex_lock(trace->libtrace_lock);
     2106        ret = trace->global_blob;
     2107        trace->global_blob = data;
     2108        pthread_mutex_unlock(trace->libtrace_lock);
     2109        return ret;
    21122110}
    21132111
Note: See TracChangeset for help on using the changeset viewer.