8 #define epicsExportSharedSymbols 12 namespace epics {
namespace pvData {
17 typedef void (*
fn_t)(
void*);
27 #if __cplusplus>=201103L 28 struct BindRunner :
public epicsThreadRunable
30 typedef std::function<void()>
fn_t;
32 BindRunner(fn_t&& f) :
fn(std::move(f)) {}
33 virtual ~BindRunner() {}
43 Runnable& Thread::Config::x_getrunner()
46 throw std::logic_error(
"Thread::Config missing run()");
47 return *this->p_runner;
50 void Thread::Config::x_setdefault()
53 this->p_autostart =
true;
54 this->p_runner =
NULL;
66 #if __cplusplus>=201103L 71 { this->p_strm.str(n);
return *
this; }
74 { this->p_prio = p;
return *
this; }
80 { this->p_autostart = a;
return *
this; }
83 { this->p_runner = r;
return *
this; }
88 this->p_runner = this->p_owned_runner.get();
92 #if __cplusplus>=201103L 95 this->p_owned_runner.reset(
new detail::BindRunner(std::move(
fn)));
96 this->p_runner = this->p_owned_runner.get();
116 unsigned int stksize,
117 unsigned int priority)
132 #if __cplusplus>=201103L 133 p_owned = std::move(c.p_owned_runner);
135 p_owned = c.p_owned_runner;
static size_t num_instances
Config & stack(epicsThreadStackSizeClass s)
TODO only here because of the Lockable.
Config & prio(unsigned int p)
Config & name(const std::string &n)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize(epicsThreadStackSizeClass size)
epicsThreadStackSizeClass
FuncRunner(fn_t f, void *a)
#define epicsThreadPriorityLow
Create a new thread using the given.
Thread(std::string name, ThreadPriority priority, Runnable *runnable, epicsThreadStackSizeClass stkcls=epicsThreadStackBig)
Config & autostart(bool a)
C++ and C descriptions for a thread.
epicsThreadRunable Runnable
Config & run(Runnable *r)
Thread will execute Runnable::run()