19 #ifndef NDB_THREAD_HPP
20 #define NDB_THREAD_HPP
23 #include <NdbCondition.h>
24 #include <NdbThread.h>
28 void* NDBT_Thread_run(
void* arg);
64 assert(m_thread_set != 0);
67 inline int get_thread_no()
const {
89 inline void set_func(NDBT_ThreadFunc* func) {
94 inline void set_input(
const void* input) {
97 inline const void* get_input()
const {
102 inline void set_output(
void* output) {
105 inline void* get_output()
const {
108 template <
class T>
inline void set_output() {
112 inline void delete_output() {
119 inline class Ndb* get_ndb()
const {
129 void set_err(
int err) {
132 int get_err()
const {
138 friend void* NDBT_Thread_run(
void* arg);
140 enum { Magic = 0xabacadae };
147 NDBT_ThreadFunc* m_func;
157 NdbMutex_Lock(m_mutex);
160 NdbMutex_Unlock(m_mutex);
164 NdbCondition_Wait(m_cond, m_mutex);
167 NdbCondition_Signal(m_cond);
188 inline int get_count()
const {
192 assert(n < m_count && m_thread[n] != 0);
206 void set_func(NDBT_ThreadFunc* func);
209 void set_input(
const void* input);
212 template <
class T>
inline void set_output() {
213 for (
int n = 0; n < m_count; n++) {
218 void delete_output();