1#ifndef _DRAMA2_THREADUFACE_INC
2#define _DRAMA2_THREADUFACE_INC
35#include <condition_variable>
66 class TUface :
public TMessHandler,
public RunDramaExitNotifier {
74 std::weak_ptr<Task> _theTask;
81 static std::set<TUface *> _loggerOnly;
137 virtual bool JoinThreads(std::chrono::steady_clock::time_point
until)
override;
145 std::shared_ptr<Task>
GetTask()
const override {
146 return std::shared_ptr<Task>(_theTask);
186 template<
typename...
Types>
194 std::stringstream
sstrm;
266 _loggerOnly.insert(
this);
287 WaitEventMapType _waitEventMap;
290 void MessageReceived();
291 void ProcessSubsidiaryMessage();
295 static void UfaceMessageHandler(
StatusType *);
301 void OrphanOutstandingEvents();
309 _entryInfo.SetFromDits();
326 WaitEventDetails *FindWaitEventDetails(std::thread::id)
338 std::thread::id
threadId(std::this_thread::get_id());
357 *eventInfo =
details.eventInfo;
void SetFromDits()
Grab the information of interest from DITS.
Definition entryinfo.hh:123
The EntryInfo class is used to access details about a DRAMA message event (and entry to an action).
Definition entryinfo.hh:106
A Class which provides access to DRAMA's message sending facilities.
Definition path.hh:689
Class used to arrange for notifications when the RunDrama exits.
Definition task.hh:382
std::recursive_timed_mutex mutexType
Defines the type of our mutex.
Definition task.hh:455
This interface class must be implemented by classes which have threads waiting for messages.
Definition thread.hh:308
static bool ___LoggerOnlyUFACEItem(TUface *pnt)
Indicate if logger only UFACE item created when Logger::RegisterThreadNoDramaCtx() was invoked (Actua...
void MessageUser(const std::string &text) const override
Use DRAMA to send a message to the user.
void WaitForTransactionFinish(const WaitEventData &details, TransEvtInfo *const eventInfo, sds::IdPtr *const arg)
The wait for transaction operation has finished - tidy up.
Definition threaduface.hh:378
std::shared_ptr< Task > GetTask() const override
Get a reference to the DRAMA task we are part of.
Definition threaduface.hh:172
void SetupWaitEvent(DitsTransIdType tid, drama::Path *pathObj) override
Sets up a wait event for this thread.
virtual const EntryInfo & GetEntry() const
Return the entry details.
Definition threaduface.hh:275
TUface(std::weak_ptr< Task > dramaTask, const std::string &logThreadName="TUface::TUface")
Create a DRAMA action/message handler object which runs a thread when the Obey message is received.
Task::mutexType & Lock() const override
Reference the DRAMA Task lock.
virtual ~TUface()
TUface destructor.
void MessageUser(const char *format, Types... args)
Use DRAMA to send a message to the user - safe format.
Definition threaduface.hh:214
virtual bool JoinThreads(std::chrono::steady_clock::time_point until) override
Invoked when the drama::task::RunDrama() loop exits.
void ClearWait(bool complete) override
Clear the thread' waiting flag in _waitEventMap.
WaitEventDetails * WaitForTransactionStart()
Initiate waiting for a transaction and return a pointer to the item the wait event details.
Definition threaduface.hh:364
virtual int RunDramaHasExited() override
Invoked when the drama::task::RunDrama() loop exits.
Dits___CurActType GetMessageContext() const override
Get the DRAMA Context associated with the UFACE event.
void ___SetLoggerOnlyUFACEItem()
Indicate that this UFACE item is for a thread which invoked Logger::RegisterThreadNoDramaCtx() withou...
Definition threaduface.hh:287
void GrabEntryInfo()
Fetch the DRAMA Entry information.
Definition threaduface.hh:335
A class which allows threads running in a User Interface or similar environments to send DRAMA messag...
Definition threaduface.hh:93
DRAMA 2 include file - Message Handler class definition.
std::shared_ptr< Id > IdPtr
A shared pointer for sds::Id items.
Definition sds.hh:3318
void SignalDramaToExit(std::weak_ptr< Task > dramaTask, StatusType exitStatus=STATUS__OK)
Signal to DRAMA that this task should exit.
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
void SafePrintf(std::ostream &ostream, const char *str)
Safe formatted write to a stream.
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93
Structure is used to store details about a DRAMA reschedule message relating to a transaction,...
Definition task.hh:128
DRAMA 2 include file - Code common to DRAMA 2 features supporting threading.