forked from BioinformaticsArchive/blasr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MappingSemaphores.h
45 lines (41 loc) · 949 Bytes
/
MappingSemaphores.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
#ifndef ALIGNMENT_MAPPING_SEMAPHORE_H_
#define ALIGNMENT_MAPPING_SEMAPHORE_H_
#include <vector>
#include <pthread.h>
#include <semaphore.h>
#ifndef __APPLE__
class MappingSemaphores {
public:
sem_t reader;
sem_t writer;
sem_t unaligned;
sem_t hitCluster;
MappingSemaphores& operator=(MappingSemaphores &rhs) {
return *this;
}
void InitializeAll() {
sem_init(&reader, 0, 1);
sem_init(&writer, 0, 1);
sem_init(&unaligned, 0, 1);
sem_init(&hitCluster, 0, 1);
}
};
#else
class MappingSemaphores {
public:
sem_t *reader;
sem_t *writer;
sem_t *unaligned;
sem_t *hitCluster;
MappingSemaphores& operator=(MappingSemaphores &rhs) {
return *this;
}
void InitializeAll() {
reader = sem_open("/reader", O_CREAT, 0644, 1);
writer = sem_open("/writer", O_CREAT, 0644, 1);
unaligned = sem_open("/unaligned", O_CREAT, 0644, 1);
hitCluster = sem_open("/hitCluster", O_CREAT, 0644, 1);
}
};
#endif
#endif