Beamlib  3.0.1
This is the Beam C++ class library.
BThread.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BThread.h BThread Classes
3  * T.Barnaby, BEAM Ltd, 31/3/00
4  * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5  * For license see LICENSE.txt at the root of the beamlib source tree.
6  *******************************************************************************
7  */
8 #ifndef BTHREAD_H
9 #define BTHREAD_H 1
10 
11 #include <pthread.h>
12 
14 class BThread {
15 public:
16  BThread();
17  virtual ~BThread();
18 
19  // Prior to start setup
20  int setInitPriority(int policy, int priority);
21  int setInitStackSize(size_t stackSize);
22 
23  int start();
24  void* result();
25  int running();
26 
27  int setPriority(int policy, int priority);
28  int cancel();
29  void* waitForCompletion();
30  pthread_t getThread();
31 
32  virtual void* function();
33 private:
34  static void* startFunc(void*);
35 
36  pthread_t othread;
37  size_t ostackSize;
38  int opolicy;
39  int opriority;
40  int orunning;
41  void* oresult;
42 };
43 
44 #endif
Implements a program execution thread.
Definition: BThread.h:14
int setInitStackSize(size_t stackSize)
Definition: BThread.cpp:91
pthread_t getThread()
Definition: BThread.cpp:110
BThread()
Definition: BThread.cpp:22
int cancel()
Definition: BThread.cpp:82
void * waitForCompletion()
Definition: BThread.cpp:86
virtual ~BThread()
Definition: BThread.cpp:47
void * result()
Definition: BThread.cpp:70
int setPriority(int policy, int priority)
Definition: BThread.cpp:102
int running()
Definition: BThread.cpp:74
int start()
Definition: BThread.cpp:50
int setInitPriority(int policy, int priority)
Definition: BThread.cpp:96