Belle II Software light-2406-ragdoll
SemaphoreLocker.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <sys/types.h>
11
12namespace Belle2 {
25 public:
27 explicit SemaphoreLocker(int semId): m_id(semId) { lock(); }
30
32 static int create(key_t semkey);
34 static void destroy(int semId);
35
41 static bool isLocked(int semId);
42
47 void lock();
49 void unlock();
50
51 private:
52 int m_id;
53 };
55}
Handles creation, locking and unlocking of System V semaphores.
static void destroy(int semId)
Destroy the given semaphore.
static int create(key_t semkey)
Create a new semaphore and initialize it.
SemaphoreLocker(int semId)
Lock the given semaphore.
void unlock()
Unlock the semaphore.
void lock()
Lock the semaphore.
int m_id
semaphore id, see semget(2).
static bool isLocked(int semId)
Return true if the given semaphore is locked.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24