ATLAS Offline Software
Loading...
Searching...
No Matches
ONCRPCThreadCollection.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 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 <pthread.h>
10#include <semaphore.h>
11
12namespace JiveXML{
13
17 class ThreadCollection : private std::vector<pthread_t> {
18
19 public:
20
21 //Constructor
23
24 //Destructor
26
29 //Add a thread
30 void AddThread( const pthread_t& thread );
31
32 //Wait till the thread has been added
33 void WaitAdd();
34
35 //Remove a thread
36 void RemoveThread( const pthread_t& thread );
37
38 //Wait for all threads to finish
39 void JoinAll();
40
41 //Return number of threads
42 //Can't be const as it requires mutex
43 int NumberOfThreads();
45
46 private:
47 //mutex to assure no conflicts when adding/removing threads
48 pthread_mutex_t m_mutex;
49 //Semaphore to assure we add all threads
51 };
52
53}
54#endif
55
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.