File: MappingSemaphores.h

package info (click to toggle)
blasr 5.3.5%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,196 kB
  • sloc: cpp: 8,412; ansic: 806; python: 331; sh: 178; java: 158; makefile: 36
file content (40 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (5)
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
#pragma once

#include <pthread.h>
#include <semaphore.h>
#include <vector>

#ifndef __APPLE__
class MappingSemaphores
{
public:
    sem_t reader;
    sem_t writer;
    sem_t unaligned;
    sem_t hitCluster;

    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;
    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