Skip to content

Commit

Permalink
Remove use of atomics, not available on EPICS 3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
exzombie committed Jun 12, 2024
1 parent d066b68 commit 30b8c87
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions asyn/asynPortDriver/asynPortDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include <epicsString.h>
#include <epicsMutex.h>
#include <epicsAtomic.h>
#include <epicsThread.h>
#include <cantProceed.h>
/* NOTE: interruptAccept is define in dbAccess.h if using EPICS IOC, else set it to 1 */
Expand Down Expand Up @@ -4128,7 +4127,10 @@ asynStatus asynPortDriver::createParams()

/** Returns `true` when the port is destructible and `shutdown()` wasn't run yet. */
bool asynPortDriver::needsShutdown() {
return epics::atomic::get(shutdownNeeded);
lock();
bool ret = shutdownNeeded;
unlock();
return ret;
}

/** Performs cleanup that cannot be done in a destructor.
Expand All @@ -4149,8 +4151,8 @@ void asynPortDriver::shutdownPortDriver() {
// Which would leave a "working" port with dangling references. So let's
// disarm the exception callback (because we are already being destroyed)
// and shutdown the port.
if (needsShutdown()) {
epics::atomic::set(shutdownNeeded, 0);
if (shutdownNeeded) {
shutdownNeeded = 0;
asynStatus status = pasynManager->shutdownPort(pasynUserSelf);
if(status != asynSuccess) {
printf("%s\n", pasynUserSelf->errorMessage);
Expand Down

0 comments on commit 30b8c87

Please sign in to comment.