This is Unofficial EPICS BASE Doxygen Site
epics::pvAccess::ca::PutDoneThread Class Reference

#include "putDoneThread.h"

+ Inheritance diagram for epics::pvAccess::ca::PutDoneThread:
+ Collaboration diagram for epics::pvAccess::ca::PutDoneThread:

Public Member Functions

 ~PutDoneThread ()
 
virtual void run ()
 
void start ()
 
void stop ()
 
void putDone (NotifyPutRequesterPtr const &notifyPutRequester)
 

Static Public Member Functions

static PutDoneThreadPtr get ()
 

Detailed Description

Definition at line 47 of file putDoneThread.h.

Constructor & Destructor Documentation

epics::pvAccess::ca::PutDoneThread::~PutDoneThread ( )

Definition at line 40 of file putDoneThread.cpp.

41 {
42 //std::cout << "PutDoneThread::~PutDoneThread()\n";
43 }

Member Function Documentation

PutDoneThreadPtr epics::pvAccess::ca::PutDoneThread::get ( )
static

Definition at line 23 of file putDoneThread.cpp.

24 {
25  static PutDoneThreadPtr master;
26  static Mutex mutex;
27  Lock xx(mutex);
28  if(!master) {
29  master = PutDoneThreadPtr(new PutDoneThread());
30  master->start();
31  }
32  return master;
33 }
A lock for multithreading.
Definition: lock.h:36
std::tr1::shared_ptr< PutDoneThread > PutDoneThreadPtr
Definition: caChannel.h:54
epicsMutex Mutex
Definition: lock.h:28
void epics::pvAccess::ca::PutDoneThread::putDone ( NotifyPutRequesterPtr const &  notifyPutRequester)

Definition at line 67 of file putDoneThread.cpp.

68 {
69  {
70  Lock lock(mutex);
71  if(notifyPutRequester->isOnQueue) return;
72  notifyPutRequester->isOnQueue = true;
73  notifyPutQueue.push(notifyPutRequester);
74  }
75  waitForCommand.signal();
76 }
epicsMutexId lock
Definition: osiClockTime.c:37
A lock for multithreading.
Definition: lock.h:36
void epics::pvAccess::ca::PutDoneThread::run ( )
virtual

Definition at line 78 of file putDoneThread.cpp.

79 {
80  while(true)
81  {
82  waitForCommand.wait();
83  while(true) {
84  bool more = false;
85  NotifyPutRequester* notifyPutRequester(NULL);
86  {
87  Lock lock(mutex);
88  if(!notifyPutQueue.empty())
89  {
90  more = true;
91  NotifyPutRequesterWPtr req(notifyPutQueue.front());
92  notifyPutQueue.pop();
93  NotifyPutRequesterPtr reqPtr(req.lock());
94  if(reqPtr) {
95  notifyPutRequester = reqPtr.get();
96  reqPtr->isOnQueue = false;
97  }
98  }
99  }
100  if(!more) break;
101  if(notifyPutRequester!=NULL)
102  {
103  CAChannelPutPtr channelPut(notifyPutRequester->channelPut.lock());
104  if(channelPut) channelPut->notifyClient();
105  }
106  }
107  if(isStop) {
108  waitForStop.signal();
109  break;
110  }
111  }
112 }
epicsMutexId lock
Definition: osiClockTime.c:37
A lock for multithreading.
Definition: lock.h:36
#define NULL
Definition: catime.c:38
std::tr1::shared_ptr< CAChannelPut > CAChannelPutPtr
Definition: caChannel.h:60
std::tr1::weak_ptr< NotifyPutRequester > NotifyPutRequesterWPtr
Definition: caChannel.h:53
std::tr1::shared_ptr< NotifyPutRequester > NotifyPutRequesterPtr
Definition: caChannel.h:51
void epics::pvAccess::ca::PutDoneThread::start ( )

Definition at line 46 of file putDoneThread.cpp.

47 {
48  thread = std::tr1::shared_ptr<epicsThread>(new epicsThread(
49  *this,
50  "putDoneThread",
53  thread->start();
54 }
LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize(epicsThreadStackSizeClass size)
Definition: osdThread.c:466
#define epicsThreadPriorityLow
Definition: epicsThread.h:75
void epics::pvAccess::ca::PutDoneThread::stop ( )

Definition at line 57 of file putDoneThread.cpp.

58 {
59  {
60  Lock xx(mutex);
61  isStop = true;
62  }
63  waitForCommand.signal();
64  waitForStop.wait();
65 }
A lock for multithreading.
Definition: lock.h:36

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