epicsThreadOnce crashes in static object destructor on win32

Bug #861214 reported by James Rowland on 2011-09-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
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;
}

Related branches

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) on 2011-11-08
Changed in epics-base:
status: In Progress → Fix Committed
Andrew Johnson (anj) on 2011-12-12
Changed in epics-base:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers