Pathfinding thread library
pathfinding.cpp@0:2f4ac599c1b7, 2017-08-23 (annotated)
- Committer:
- williampeers
- Date:
- Wed Aug 23 02:25:50 2017 +0000
- Revision:
- 0:2f4ac599c1b7
- Child:
- 1:c61d8bf5c357
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
williampeers | 0:2f4ac599c1b7 | 1 | #include "pathfinding.h" |
williampeers | 0:2f4ac599c1b7 | 2 | |
williampeers | 0:2f4ac599c1b7 | 3 | /* |
williampeers | 0:2f4ac599c1b7 | 4 | Initialise object. |
williampeers | 0:2f4ac599c1b7 | 5 | Call initators for any local objects. |
williampeers | 0:2f4ac599c1b7 | 6 | */ |
williampeers | 0:2f4ac599c1b7 | 7 | Pathfinding::Pathfinding(osPriority priority, int memory){ |
williampeers | 0:2f4ac599c1b7 | 8 | pathfinding_thread = new Thread(priority, memory); |
williampeers | 0:2f4ac599c1b7 | 9 | } |
williampeers | 0:2f4ac599c1b7 | 10 | |
williampeers | 0:2f4ac599c1b7 | 11 | /* |
williampeers | 0:2f4ac599c1b7 | 12 | Infinite loop that will be run. like a main loop. |
williampeers | 0:2f4ac599c1b7 | 13 | */ |
williampeers | 0:2f4ac599c1b7 | 14 | void Pathfinding::run() { |
williampeers | 0:2f4ac599c1b7 | 15 | while (true) { |
williampeers | 0:2f4ac599c1b7 | 16 | |
williampeers | 0:2f4ac599c1b7 | 17 | } |
williampeers | 0:2f4ac599c1b7 | 18 | } |
williampeers | 0:2f4ac599c1b7 | 19 | |
williampeers | 0:2f4ac599c1b7 | 20 | /* |
williampeers | 0:2f4ac599c1b7 | 21 | Called by main at the start of operation to start the thread running. |
williampeers | 0:2f4ac599c1b7 | 22 | */ |
williampeers | 0:2f4ac599c1b7 | 23 | void Pathfinding::start() { |
williampeers | 0:2f4ac599c1b7 | 24 | pathfinding_thread.start(callback(this, &Pathfinding::run)); |
williampeers | 0:2f4ac599c1b7 | 25 | } |