ATLAS Offline Software
Loading...
Searching...
No Matches
ONCRPCThreadCollection.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef JIVEXML_ONCRPCTHREADCOLLECTION_H
6#define JIVEXML_ONCRPCTHREADCOLLECTION_H
7
8#include <vector>
9#include <mutex>
10#include <pthread.h>
11#include <semaphore.h>
12
13namespace JiveXML{
14
18 class ThreadCollection : private std::vector<pthread_t> {
19
20 public:
21
22 //Constructor
24
25 //Destructor
27
30 //Add a thread
31 void AddThread( const pthread_t& thread );
32
33 //Wait till the thread has been added
34 void WaitAdd();
35
36 //Remove a thread
37 void RemoveThread( const pthread_t& thread );
38
39 //Wait for all threads to finish
40 void JoinAll();
41
42 //Return number of threads
43 //Can't be const as it requires mutex
44 int NumberOfThreads();
46
47 private:
48 //mutex to assure no conflicts when adding/removing threads
49 std::mutex m_mutex;
50 //Semaphore to assure we add all threads
52 };
53
54}
55#endif
56
void RemoveThread(const pthread_t &thread)
void AddThread(const pthread_t &thread)
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.