00001 // @(#)root/thread:$Id: TPosixThreadFactory.cxx 29797 2009-08-17 14:35:51Z rdm $ 00002 // Author: Fons Rademakers 01/07/97 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 ////////////////////////////////////////////////////////////////////////// 00013 // // 00014 // TPosixThreadFactory // 00015 // // 00016 // This is a factory for Posix thread components. // 00017 // // 00018 ////////////////////////////////////////////////////////////////////////// 00019 00020 #include "TPosixThreadFactory.h" 00021 #include "TPosixMutex.h" 00022 #include "TPosixCondition.h" 00023 #include "TPosixThread.h" 00024 00025 // Force creation of TPosixThreadFactory when shared library will be loaded 00026 // (don't explicitely create a TPosixThreadFactory). 00027 static TPosixThreadFactory gPosixThreadFactoryCreator; 00028 00029 ClassImp(TPosixThreadFactory) 00030 00031 //______________________________________________________________________________ 00032 TPosixThreadFactory::TPosixThreadFactory(const char *name, const char *title) : 00033 TThreadFactory(name, title) 00034 { 00035 // Create Posix thread factory. Also sets global gThreadFactory to this. 00036 00037 gThreadFactory = this; 00038 } 00039 00040 //______________________________________________________________________________ 00041 TMutexImp *TPosixThreadFactory::CreateMutexImp(Bool_t recursive=kFALSE) 00042 { 00043 // Return a Posix Mutex. 00044 00045 return new TPosixMutex(recursive); 00046 } 00047 00048 //______________________________________________________________________________ 00049 TThreadImp *TPosixThreadFactory::CreateThreadImp() 00050 { 00051 // Return a Posix thread. 00052 00053 return new TPosixThread; 00054 } 00055 00056 //______________________________________________________________________________ 00057 TConditionImp *TPosixThreadFactory::CreateConditionImp(TMutexImp *m) 00058 { 00059 // Return a Posix condition variable. 00060 00061 return new TPosixCondition(m); 00062 }