-
Notifications
You must be signed in to change notification settings - Fork 5
/
threading.h
47 lines (38 loc) · 909 Bytes
/
threading.h
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
/**
* ocv_ar - OpenCV based Augmented Reality library
*
* Helper function class for threading -- header file.
*
* Author: Markus Konrad <konrad@htw-berlin.de>, July 2014.
* INKA Research Group, HTW Berlin - http://inka.htw-berlin.de/
*
* See LICENSE for license.
*/
#ifndef OCV_AR_THREADING_H
#define OCV_AR_THREADING_H
#include <pthread.h>
namespace ocv_ar {
/**
* Simple threading class that mainly manages a mutex variable.
* Threading is necessary in the tracker, when its update() method
* is called from a different thread than the detect() method.
*/
class Threading {
public:
/**
* Initialize the mutex.
*/
static void init();
/**
* Lock the mutex.
*/
static void mutexLock();
/**
* Unlock the mutex.
*/
static void mutexUnlock();
private:
static pthread_mutex_t mutex; // pthread mutex variable
};
}
#endif