This is Unofficial EPICS BASE Doxygen Site
ipAddrToAsciiEnginePrivate Class Reference
+ Inheritance diagram for ipAddrToAsciiEnginePrivate:
+ Collaboration diagram for ipAddrToAsciiEnginePrivate:

Public Member Functions

 ipAddrToAsciiEnginePrivate ()
 
virtual ~ipAddrToAsciiEnginePrivate ()
 
void show (unsigned level) const
 
ipAddrToAsciiTransactioncreateTransaction ()
 
void release ()
 

Public Attributes

unsigned refcount
 
bool released
 

Static Public Attributes

static ipAddrToAsciiGlobal * pEngine = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from ipAddrToAsciiEngine
static ipAddrToAsciiEngineallocate ()
 
- Protected Member Functions inherited from ipAddrToAsciiEngine
virtual ~ipAddrToAsciiEngine ()=0
 

Detailed Description

Definition at line 106 of file ipAddrToAsciiAsynchronous.cpp.

Constructor & Destructor Documentation

ipAddrToAsciiEnginePrivate::ipAddrToAsciiEnginePrivate ( )
inline
virtual ipAddrToAsciiEnginePrivate::~ipAddrToAsciiEnginePrivate ( )
inlinevirtual

Definition at line 110 of file ipAddrToAsciiAsynchronous.cpp.

110 {}

Member Function Documentation

ipAddrToAsciiTransaction & ipAddrToAsciiEnginePrivate::createTransaction ( )
virtual

Implements ipAddrToAsciiEngine.

Definition at line 283 of file ipAddrToAsciiAsynchronous.cpp.

284 {
285  epicsGuard <epicsMutex> G(this->pEngine->mutex);
286  if(this->released)
287  throw std::logic_error("createTransaction() on release()'d ipAddrToAsciiEngine");
288 
289  assert(this->refcount>0);
290 
291  ipAddrToAsciiTransactionPrivate *ret = new ( this->pEngine->transactionFreeList ) ipAddrToAsciiTransactionPrivate ( *this );
292 
293  this->refcount++;
294 
295  return * ret;
296 }
#define assert(exp)
Declare that a condition should be true.
Definition: epicsAssert.h:70
static ipAddrToAsciiGlobal * pEngine
void ipAddrToAsciiEnginePrivate::release ( )
virtual

Implements ipAddrToAsciiEngine.

Definition at line 184 of file ipAddrToAsciiAsynchronous.cpp.

185 {
186  bool last;
187  {
188  epicsGuard < epicsMutex > guard ( this->pEngine->mutex );
189  if(released)
190  throw std::logic_error("Engine release() called again!");
191 
192  // released==true prevents new transactions
193  released = true;
194 
195  {
196  // cancel any pending transactions
198  while(it.valid()) {
199  ipAddrToAsciiTransactionPrivate *trn = it.pointer();
200  ++it;
201 
202  if(this==&trn->engine) {
203  trn->pending = false;
204  pEngine->labor.remove(*trn);
205  }
206  }
207 
208  // cancel transaction in lookup or callback
209  if (pEngine->pCurrent && this==&pEngine->pCurrent->engine) {
210  pEngine->pCurrent->pending = false;
211  pEngine->pCurrent = 0;
212  }
213 
214  // wait for completion of in-progress callback
215  pEngine->cancelPendingCount++;
216  while(pEngine->pActive && this==&pEngine->pActive->engine
217  && ! pEngine->thread.isCurrentThread()) {
218  epicsGuardRelease < epicsMutex > unguard ( guard );
219  pEngine->destructorBlockEvent.wait();
220  }
221  pEngine->cancelPendingCount--;
222  if(pEngine->cancelPendingCount)
223  pEngine->destructorBlockEvent.signal();
224  }
225 
226  assert(refcount>0);
227  last = 0==--refcount;
228  }
229  if(last) {
230  delete this;
231  }
232 }
#define assert(exp)
Declare that a condition should be true.
Definition: epicsAssert.h:70
static ipAddrToAsciiGlobal * pEngine
void ipAddrToAsciiEnginePrivate::show ( unsigned  level) const
virtual

Implements ipAddrToAsciiEngine.

Definition at line 234 of file ipAddrToAsciiAsynchronous.cpp.

235 {
236  epicsGuard < epicsMutex > guard ( this->pEngine->mutex );
237  printf ( "ipAddrToAsciiEngine at %p with %u requests pending\n",
238  static_cast <const void *> (this), this->pEngine->labor.count () );
239  if ( level > 0u ) {
241  pItem = this->pEngine->labor.firstIter ();
242  while ( pItem.valid () ) {
243  pItem->show ( level - 1u );
244  pItem++;
245  }
246  }
247  if ( level > 1u ) {
248  printf ( "mutex:\n" );
249  this->pEngine->mutex.show ( level - 2u );
250  printf ( "laborEvent:\n" );
251  this->pEngine->laborEvent.show ( level - 2u );
252  printf ( "exitFlag boolean = %u\n", this->pEngine->exitFlag );
253  printf ( "exit event:\n" );
254  }
255 }
#define printf
Definition: epicsStdio.h:41
bool valid() const
Definition: tsDLList.h:607
static ipAddrToAsciiGlobal * pEngine

Member Data Documentation

ipAddrToAsciiGlobal * ipAddrToAsciiEnginePrivate::pEngine = 0
static

Definition at line 116 of file ipAddrToAsciiAsynchronous.cpp.

unsigned ipAddrToAsciiEnginePrivate::refcount

Definition at line 113 of file ipAddrToAsciiAsynchronous.cpp.

bool ipAddrToAsciiEnginePrivate::released

Definition at line 114 of file ipAddrToAsciiAsynchronous.cpp.


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