Changeset 528a27c for lib


Ignore:
Timestamp:
06/26/18 18:04:03 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, master, rc-4.0.4, ringdecrementfix, ringperformance
Children:
32ee9b2
Parents:
f9df20e
Message:

Add mutex around pagesize in format_linux_ring.c

This is just to keep helgrind happy -- probably not strictly
necessary but unlikely to impact performance in any meaningful
way.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux_ring.c

    r1060b6d r528a27c  
    7070/* Cached page size, the page size shouldn't be changing */
    7171static int pagesize = 0;
     72
     73static pthread_mutex_t pagesize_mutex;
    7274
    7375/*
     
    8890        struct ifreq ifr;
    8991        unsigned max_frame = LIBTRACE_PACKET_BUFSIZE;
    90         pagesize = getpagesize();
     92        pthread_mutex_lock(&pagesize_mutex);
     93        if (pagesize == 0) {
     94                pagesize = getpagesize();
     95        }
     96        pthread_mutex_unlock(&pagesize_mutex);
    9197
    9298        strcpy(ifr.ifr_name, uri);
     
    835841void linuxring_constructor(void)
    836842{
     843        pthread_mutex_init(&pagesize_mutex, NULL);
    837844        register_format(&linuxring);
    838845}
Note: See TracChangeset for help on using the changeset viewer.