forked from ivanseidel/ArduinoThread
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThreadController.h
More file actions
Latest commit
53 lines (38 loc) · 1.21 KB
/
Copy pathThreadController.h
File metadata and controls
53 lines (38 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
ThreadController.h - Controlls a list of Threads with different timings
Basicaly, what it does is to keep track of current Threads and run when
necessary.
ThreadController is an extended class of Thread, because of that,
it allows you to add a ThreadController inside another ThreadController...
For instructions, go to https://github.com/ivanseidel/ArduinoThread
Created by Ivan Seidel Gomes, March, 2013.
Released into the public domain.
*/
#ifndef ThreadController_h
#defineThreadController_h
#include"Thread.h"
#include"inttypes.h"
#defineMAX_THREADS15
classThreadController: publicThread{
protected:
Thread* thread[MAX_THREADS];
int cached_size;
public:
ThreadController(unsignedlong _interval = 0);
// run() Method is overrided
voidrun();
// Adds a thread in the first available slot (remove first)
// Returns if the Thread could be added or not
booladd(Thread* _thread);
// remove the thread (given the Thread* or ThreadID)
voidremove(int _id);
voidremove(Thread* _thread);
// Removes all threads
voidclear();
// Return the quantity of Threads
intsize(bool cached = true);
// Return the I Thread on the array
// Returns NULL if none found
Thread* get(int index);
};
#endif