add putDoneThread and getDoneThread; fix issue 114
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Copyright - See the COPYRIGHT that is included with this distribution.
|
||||
* pvAccessCPP is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
/**
|
||||
* @author mrk
|
||||
* @date 2018.07
|
||||
*/
|
||||
#ifndef PutDoneThread_H
|
||||
#define PutDoneThread_H
|
||||
#include <queue>
|
||||
#include <cadef.h>
|
||||
#include <shareLib.h>
|
||||
#include <epicsThread.h>
|
||||
#include <pv/event.h>
|
||||
#include <pv/lock.h>
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
namespace ca {
|
||||
|
||||
class NotifyPutRequester;
|
||||
typedef std::tr1::shared_ptr<NotifyPutRequester> NotifyPutRequesterPtr;
|
||||
typedef std::tr1::weak_ptr<NotifyPutRequester> NotifyPutRequesterWPtr;
|
||||
|
||||
|
||||
class PutDoneThread;
|
||||
typedef std::tr1::shared_ptr<PutDoneThread> PutDoneThreadPtr;
|
||||
|
||||
class CAChannelPut;
|
||||
typedef std::tr1::shared_ptr<CAChannelPut> CAChannelPutPtr;
|
||||
typedef std::tr1::weak_ptr<CAChannelPut> CAChannelPutWPtr;
|
||||
|
||||
class NotifyPutRequester
|
||||
{
|
||||
public:
|
||||
ChannelPutRequester::weak_pointer channelPutRequester;
|
||||
CAChannelPutWPtr channelPut;
|
||||
bool isOnQueue;
|
||||
NotifyPutRequester() : isOnQueue(false) {}
|
||||
void setChannelPut(CAChannelPutPtr const &channelPut)
|
||||
{ this->channelPut = channelPut;}
|
||||
};
|
||||
|
||||
|
||||
class PutDoneThread :
|
||||
public epicsThreadRunable
|
||||
{
|
||||
public:
|
||||
static PutDoneThreadPtr get();
|
||||
~PutDoneThread();
|
||||
virtual void run();
|
||||
void start();
|
||||
void stop();
|
||||
void putDone(NotifyPutRequesterPtr const ¬ifyPutRequester);
|
||||
private:
|
||||
PutDoneThread();
|
||||
bool isStop;
|
||||
std::tr1::shared_ptr<epicsThread> thread;
|
||||
epics::pvData::Mutex mutex;
|
||||
epics::pvData::Event waitForCommand;
|
||||
epics::pvData::Event waitForStop;
|
||||
std::queue<NotifyPutRequesterWPtr> notifyPutQueue;
|
||||
};
|
||||
|
||||
|
||||
}}}
|
||||
|
||||
#endif /* PutDoneThread_H */
|
||||
Reference in New Issue
Block a user