Skip to content
Snippets Groups Projects
Commit 370ea141 authored by benjamin.franksen's avatar benjamin.franksen
Browse files

seq: place program lock around wakeup commands in ca callback

This prevents a race condition resulting in a crash when the program
shuts down and deletes mutexes etc before the callback has issued its
final ss_wakeup call.
parent 9ee923cb
No related branches found
No related tags found
No related merge requests found
......@@ -305,21 +305,23 @@ static void proc_db_events(
Set the dirty flag only if this was a monitor event. */
ss_write_buffer(ch, val, &meta, evtype == pvEventMonitor);
}
}
epicsMutexMustLock(sp->programLock);
/* Signal completion */
if (ss)
/* Signal completion */
if (ss)
{
switch (evtype)
{
switch (evtype)
{
case pvEventGet:
epicsEventSignal(ss->getSemId[chNum(ch)]);
break;
case pvEventPut:
epicsEventSignal(ss->putSemId[chNum(ch)]);
break;
default:
break;
}
case pvEventGet:
epicsEventSignal(ss->getSemId[chNum(ch)]);
break;
case pvEventPut:
epicsEventSignal(ss->putSemId[chNum(ch)]);
break;
default:
break;
}
}
......@@ -329,6 +331,8 @@ static void proc_db_events(
/* Wake up each state set that uses this channel in an event */
ss_wakeup(sp, ch->eventNum);
epicsMutexUnlock(sp->programLock);
}
/* Disconnect all database channels */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment