Changeset cd37cdc


Ignore:
Timestamp:
04/01/15 11:37:41 (6 years ago)
Author:
Shane Alcock <salcock@…>
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:
03f8943
Parents:
3e5518a
Message:

Block all signals in libwandio threads.

It is probably better for the main processing thread(s) to do
signal handling, rather than libwandio threads. This fixes a potential
race condition reported by helgrind for tracestats (and presumably
other tools) where the libwandio thread could modify the 'done' flag
while the main thread was checking it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libwandio/ior-thread.c

    r10f924c rcd37cdc  
    4444#include <stdbool.h>
    4545#include <errno.h>
     46#include <signal.h>
    4647#ifdef HAVE_SYS_PRCTL_H
    4748#include <sys/prctl.h>
     
    167168{
    168169        io_t *state;
     170        sigset_t set;
     171        int s;
    169172
    170173        if (!parent) {
     
    172175        }
    173176       
    174 
     177        sigfillset(&set);
    175178        state = malloc(sizeof(io_t));
    176179        state->data = calloc(1,sizeof(struct state_t));
     
    189192
    190193        /* Create the reading thread */
     194        s = pthread_sigmask(SIG_SETMASK, &set, NULL);
    191195        pthread_create(&DATA(state)->producer,NULL,thread_producer,state);
     196        sigemptyset(&set);
     197        s = pthread_sigmask(SIG_SETMASK, &set, NULL);
    192198
    193199        return state;
Note: See TracChangeset for help on using the changeset viewer.