epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

new Thread::Config #14

Closed mdavidsaver closed 8 years ago

mdavidsaver commented 8 years ago

Thread::Config has a named parameters style allowing method chaining to create a Thread with certain parameters and without the need to derive from epicsThreadRunnable. It also makes it easy to give a meaningful name (pvAccess needs work here).

using namespace epics::pvData;
klass *K = ...;
Thread foo(Thread::Config(K, &klass::meth)
                   .prio(epicsThreadPriorityMedium)
                   <<"test"<<2
                   );

Creates a thread named "test2" where the thread main is a class method. Also works with epicsThreadRunnable subclasses, and C void()(void) + void*.

If not specified, priority defaults to epicsThreadPriorityLow, stack size to epicsThreadStackSmall, and autostart to true (in keeping with the other Thread constructors).

mdavidsaver commented 8 years ago

Unless I hear an objection in the next 24 hours I'll merge this.