All threads should be created Using these macros. They have at least the following benefits:
Definition in file ThreadCreate.h.
#include <pthread.h>
#include <string>
Go to the source code of this file.
Classes | |
class | RunThreadClass |
Class marker for classes which are used for running new threads. More... | |
Defines | |
#define | runNewThread(a, b, c, f) _runNewThread(a, b, c, f, #b) |
Start a new thread in a static method or global method. | |
#define | runNewThreadClass(a, cl, b, c, f) _runNewThreadClass(a, cl, b, c, f, #b) |
Start a new thread in a class method. | |
Typedefs | |
typedef void *(* | func )(void *) |
non-class function for starting a thread | |
typedef void *(RunThreadClass::* | classfunc )(void *) |
class-member function for starting a thread | |
Functions | |
void | _runNewThread (pthread_t *t, func f, void *arg, pthread_attr_t *attr, const char *fname, bool joinThread=true) |
Generally you should not use this directly. Exceptions are if you don't want joinThread or if you want to specify a different string. | |
void | _runNewThreadClass (pthread_t *t, RunThreadClass *c, classfunc f, void *arg, pthread_attr_t *attr, const char *fname, bool joinThread=true) |
Generally you should not use this directly. Exceptions are if you don't want joinThread or if you want to specify a different string. | |
void | logThread (uint64_t vtid, const std::string &fname, bool ending=false) |
Method to do standard logging at beginning and end of thread. Declared here to be able to call in main. |
#define runNewThread | ( | a, | |||
b, | |||||
c, | |||||
f | ) | _runNewThread(a, b, c, f, #b) |
Start a new thread in a static method or global method.
a | pthread to store the created thread | |
b | the function to call on start | |
c | the void* parameter to pass the function | |
f | the pthread attributes |
Definition at line 66 of file ThreadCreate.h.
Referenced by BufferedBlockManager::open(), and Accumulator::startLogging().
#define runNewThreadClass | ( | a, | |||
cl, | |||||
b, | |||||
c, | |||||
f | ) | _runNewThreadClass(a, cl, b, c, f, #b) |
Start a new thread in a class method.
a | pthread to store the created thread | |
cl | the class object to call the function on | |
b | the function to call on start | |
c | the void* parameter to pass the function | |
f | the pthread attributes |
Definition at line 75 of file ThreadCreate.h.