Welcome to the EyeBot  Version 7 - RPi1
A Controller For Various Hardware IO
multitasking.h
Go to the documentation of this file.
1 
8 #ifndef MULTITASKING_H_
9 #define MULTITASKING_H_
10 
11 #include <pthread.h>
12 #include <semaphore.h>
13 #include "types.h"
14 
18 typedef struct
19 {
20  pthread_t thread;
21  int identifier;
22 } TASK;
23 
24 typedef sem_t SEMA;
25 
26 int MTInit(); // Start multi-tasking
27 int MTSleep(int n); // Sleep for n/100 seconds
28 TASK MTSpawn(void* (*) (void*), int); //Create and initialize thread with given ID
29 int MTGetUID(TASK); // Read ID of current thread
30 int MTKill(TASK); // Delete thread (0 for self)
31 int MTExit(void); // Terminate current thread
32 
33 
34 int SEMAInit(SEMA *sem, int val); // Create and initialiye semaphore with VAL
35 int SEMALock(SEMA* sem); // Lock semaphore
36 int SEMAUnlock(SEMA* sem); // Unlock semaphore
37 
38 #endif /*MULTITASKING_H_*/
Defines types used for the EyeBot 7.
Structure defining a TASK item.
Definition: multitasking.h:18