This is Unofficial EPICS BASE Doxygen Site
pvac::detail::CallbackStorage Struct Reference

#include "clientpvt.h"

+ Inheritance diagram for pvac::detail::CallbackStorage:
+ Collaboration diagram for pvac::detail::CallbackStorage:

Public Member Functions

 CallbackStorage ()
 

Public Attributes

epicsMutex mutex
 
epicsEvent wakeup
 
size_t nwaitcb
 
epicsThreadId incb
 

Detailed Description

Safe use of raw callback pointer while unlocked. clear pointer and then call CallbackGuard::wait() to ensure that concurrent callback have completed.

Prototype usage

struct mycb : public CallbackStorage {
void (*ptr)();
};
// make a callback
void docb(mycb& cb) {
CallbackGuard G(cb); // lock
// decide whether to make CB
if(ptr){
void (*P)() = ptr; // copy for use while unlocked
CallbackUse U(G); // unlock
(*P)();
// automatic re-lock
}
// automatic final unlock
}
void cancelop(mycb& cb) {
ptr = 0; // prevent further callbacks from starting
G.wait(); // wait for inprogress callbacks to complete
}

Definition at line 117 of file clientpvt.h.

Constructor & Destructor Documentation

pvac::detail::CallbackStorage::CallbackStorage ( )
inline

Definition at line 122 of file clientpvt.h.

122 :nwaitcb(0u), incb(0) {}

Member Data Documentation

epicsThreadId pvac::detail::CallbackStorage::incb

Definition at line 121 of file clientpvt.h.

epicsMutex pvac::detail::CallbackStorage::mutex
mutable

Definition at line 118 of file clientpvt.h.

size_t pvac::detail::CallbackStorage::nwaitcb

Definition at line 120 of file clientpvt.h.

epicsEvent pvac::detail::CallbackStorage::wakeup

Definition at line 119 of file clientpvt.h.


The documentation for this struct was generated from the following file: