epicsThreadOnce crashes in static object destructor on win32

Bug #861214 reported by James Rowland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Fix Released
Low
Unassigned

Bug Description

win32 epicsThreadOnce locks a global mutex that is destroyed by the atexit handler threadCleanupWIN32. The short example below fails.

#include <stdio.h>
#include <epicsThread.h>

epicsThreadOnceId once = EPICS_THREAD_ONCE_INIT;

void bye(void * usr)
{
    printf("bye\n");
}

struct Hello
{
    ~Hello()
        {
            epicsThreadOnce(&once, bye, NULL);
        }
};

Hello h;

int main(int argc, char *argv[])
{
    printf("hi\n");
    return 0;
}

Revision history for this message
Andrew Johnson (anj) wrote :

Just deleting the last two lines from the threadCleanupWIN32() routine should fix this, see patch. Since the process is dying it shouldn't matter that we don't clean up completely.

Changed in epics-base:
status: New → In Progress
importance: Undecided → Low
Andrew Johnson (anj)
Changed in epics-base:
status: In Progress → Fix Committed
Andrew Johnson (anj)
Changed in epics-base:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.