42#include <sdk/config.h>
55#define MP_MUTEX_ID0 "/dev/hsem14"
56#define MP_MUTEX_ID1 "/dev/hsem13"
57#define MP_MUTEX_ID2 "/dev/hsem12"
58#define MP_MUTEX_ID3 "/dev/hsem11"
59#define MP_MUTEX_ID4 "/dev/hsem10"
60#define MP_MUTEX_ID5 "/dev/hsem9"
61#define MP_MUTEX_ID6 "/dev/hsem8"
62#define MP_MUTEX_ID7 "/dev/hsem7"
63#define MP_MUTEX_ID8 "/dev/hsem6"
64#define MP_MUTEX_ID9 "/dev/hsem5"
65#define MP_MUTEX_ID10 "/dev/hsem4"
79 MPMutex(
const char *devname) : _fd(-1) {
80 strncpy(_devname, devname,
sizeof(_devname));
89 if (_create()) {
return -1; }
90 return ioctl(_fd, HSLOCK, 0);
94 if (_create()) {
return -1; }
95 return ioctl(_fd, HSTRYLOCK, 0);
98 if (_create()) {
return -1; }
99 return ioctl(_fd, HSUNLOCK, 0);
107 _fd = open(_devname, 0);
108 return (_fd < 0) ? -1 : 0;
This is the interface for MP Mutex.
Definition: MPMutex.h:77