Changeset 60e8e86


Ignore:
Timestamp:
04/10/14 20:37:14 (7 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:
17a3dff
Parents:
19135af
Message:

Add in a variable libtrace_parallel, first set when using the parallel functions. This ensures backwards compatibility with trace_destroy() calling fin_packet(), which will can segfault if the trace is already destroyed first like many existing programs do.
This means the tests pass again.

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r29bbef0 r60e8e86  
    109109
    110110int libtrace_halt = 0;
     111
     112/* Set once pstart is called used for backwards compatibility reasons */
     113extern int libtrace_parallel = 0;
    111114
    112115/* strncpy is not assured to copy the final \0, so we
     
    744747DLLEXPORT void trace_destroy_packet(libtrace_packet_t *packet) {
    745748        /* Free any resources possibly associated with the packet */
    746         if (packet->trace && packet->trace->format->fin_packet) {
     749        if (libtrace_parallel && packet->trace && packet->trace->format->fin_packet) {
    747750                packet->trace->format->fin_packet(packet);
    748751        }
  • lib/trace_parallel.c

    rabda273 r60e8e86  
    9999#include <signal.h>
    100100
     101
     102extern int libtrace_parallel;
    101103
    102104struct multithreading_stats {
     
    996998                return 0;
    997999        }
     1000
     1001        libtrace_parallel = 1;
    9981002
    9991003        // Store the user defined things against the trace
Note: See TracChangeset for help on using the changeset viewer.