Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:32

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_ITHREADINITTOOL_H
0012 #define GAUDIKERNEL_ITHREADINITTOOL_H 1
0013 
0014 #include "GaudiKernel/IAlgTool.h"
0015 
0016 //-----------------------------------------------------------------------------
0017 
0018 /** @class IThreadInitTool GaudiKernel/IThreadInitTool.h
0019  *
0020  *  @brief Abstract interface for AlgTools to do thread local initialization.
0021  *
0022  *  Tools that implement this interface can be plugged into a ThreadPoolSvc
0023  *  to be called during the initialization of each worker thread to do
0024  *  thread-local setup. Correspondingly, the tool will be invoked again at
0025  *  the end of processing in each thread to do thread-local cleanup or final
0026  *  work.
0027  *
0028  *  @author Charles Leggett
0029  *  @date   2015-09-01
0030  */
0031 
0032 //-----------------------------------------------------------------------------
0033 
0034 class IThreadInitTool : virtual public IAlgTool {
0035 
0036 public:
0037   /// Declare the interface to the framework.
0038   DeclareInterfaceID( IThreadInitTool, 1, 0 );
0039 
0040   /// Perform worker thread initialization. Called concurrently on each thread.
0041   virtual void initThread() = 0;
0042 
0043   /// Perform worker thread finalization. Called concurrently on each thread.
0044   virtual void terminateThread() = 0;
0045 
0046   /** @brief Number of threads initialized.
0047    *
0048    *  Used for some error checking. The count must be atomically incremented
0049    *  during initialization and atomically decremented during finalization.
0050    */
0051   virtual unsigned int nInit() const = 0;
0052 };
0053 
0054 #endif