Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TWin32ThreadFactory.cxx
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TWin32ThreadFactory //
15 // //
16 // This is a factory for Win32 thread components. //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #include "TWin32ThreadFactory.h"
21 #include "TWin32Mutex.h"
22 #include "TWin32Condition.h"
23 #include "TWin32Thread.h"
24 
25 // Force creation of TWin32ThreadFactory when shared library will be loaded
26 // (don't explicitly create a TWin32ThreadFactory).
27 static TWin32ThreadFactory gWin32ThreadFactoryCreator;
28 
29 ClassImp(TWin32ThreadFactory);
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 /// Create Win32 thread factory. Also sets global gThreadFactory to this.
33 
34 TWin32ThreadFactory::TWin32ThreadFactory(const char *name, const char *title) :
35  TThreadFactory(name, title)
36 {
37  gThreadFactory = this;
38 }
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Return a Win32 Mutex.
42 
43 TMutexImp *TWin32ThreadFactory::CreateMutexImp(Bool_t recursive)
44 {
45  return new TWin32Mutex(recursive);
46 }
47 
48 ////////////////////////////////////////////////////////////////////////////////
49 /// Return a Win32 thread.
50 
51 TThreadImp *TWin32ThreadFactory::CreateThreadImp()
52 {
53  return new TWin32Thread;
54 }
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 /// Return a Win32 condition variable.
58 
59 TConditionImp *TWin32ThreadFactory::CreateConditionImp(TMutexImp *m)
60 {
61  return new TWin32Condition(m);
62 }