Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TWin32Condition.h
Go to the documentation of this file.
1// @(#)root/thread:$Id$
2// Author: Bertrand Bellenot 20/10/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TWin32Condition
13#define ROOT_TWin32Condition
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TWin32Condition //
19// //
20// This class provides an interface to the win32 condition variable //
21// routines. //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "TConditionImp.h"
26
27#include "Windows4Root.h"
28
29typedef struct
30{
32 // Number of waiting threads.
33
34 CRITICAL_SECTION waiters_count_lock_;
35 // Serialize access to <waiters_count_>.
36
37 HANDLE sema_;
38 // Semaphore used to queue up threads waiting for the condition to
39 // become signaled.
40
42 // An auto-reset event used by the broadcast/signal thread to wait
43 // for all the waiting thread(s) to wake up and be released from the
44 // semaphore.
45
47 // Keeps track of whether we were broadcasting or signaling. This
48 // allows us to optimize the code if we're just signaling.
50
51class TMutexImp;
52class TWin32Mutex;
53
54
56
57private:
58 pthread_cond_t fCond; // the pthread condition variable
59 TWin32Mutex *fMutex; // mutex used around Wait() and TimedWait()
60
61public:
63 virtual ~TWin32Condition();
64
65 Int_t Wait() override;
66 Int_t TimedWait(ULong_t secs, ULong_t nanoSecs = 0) override;
67 Int_t Signal() override;
68 Int_t Broadcast() override;
69
70 ClassDefOverride(TWin32Condition,0) // Posix condition variable
71};
72
73#endif
unsigned long ULong_t
Definition RtypesCore.h:55
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Int_t TimedWait(ULong_t secs, ULong_t nanoSecs=0) override
TimedWait() is given an absolute time to wait until.
Int_t Signal() override
If one or more threads have called Wait(), Signal() wakes up at least one of them,...
pthread_cond_t fCond
virtual ~TWin32Condition()
TCondition dtor.
Int_t Broadcast() override
Broadcast is like signal but wakes all threads which have called Wait().
TWin32Mutex * fMutex
Int_t Wait() override
Wait for the condition variable to be signalled.
CRITICAL_SECTION waiters_count_lock_
TMarker m
Definition textangle.C:8