• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

acsThread.h

Go to the documentation of this file.
00001 #ifndef _ACS_THREAD_H
00002 #define _ACS_THREAD_H
00003 /*******************************************************************************
00004 * ALMA - Atacama Large Millimiter Array
00005 * (c) European Southern Observatory, 2005
00006 *
00007 * This library is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU Lesser General Public
00009 * License as published by the Free Software Foundation; either
00010 * version 2.1 of the License, or (at your option) any later version.
00011 *
00012 * This library is distributed in the hope that it will be useful,
00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 * Lesser General Public License for more details.
00016 *
00017 * You should have received a copy of the GNU Lesser General Public
00018 * License along with this library; if not, write to the Free Software
00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * "@(#) $Id: acsThread.h,v 1.32 2009/08/28 09:53:54 bjeram Exp $"
00022 *
00023 * who       when      what
00024 * --------  --------  ----------------------------------------------
00025 * bjeram  2005-02-15  created
00026 */
00027 
00028 /************************************************************************
00029  *
00030  *----------------------------------------------------------------------
00031  */
00032 
00033 #ifndef __cplusplus
00034 #error This is a C++ include file and cannot be used from plain C
00035 #endif
00036 
00037 
00038 #include "acsThreadBase.h"
00039 #include <logging.h>
00040 
00041 namespace ACS
00042 {
00043     class ThreadManager;
00044 
00045 
00059     class Thread : public ACS::ThreadBase
00060     {
00061         friend class ThreadManager;
00062 
00063       public:
00114         Thread(const ACE_CString & name,
00115                const TimeInterval& responseTime=ThreadBase::defaultResponseTime,
00116                const TimeInterval& sleepTime=ThreadBase::defaultSleepTime,
00117                const bool del=false,
00118                const long _thrFlags=THR_NEW_LWP | THR_DETACHED,
00119                const size_t stackSize = ACE_DEFAULT_THREAD_STACKSIZE);
00120 
00121 
00122         /*
00123          * This additional constructor allows to explicitly pass
00124          * thread creation flags.
00125          * In this case all other parameters have to be passed
00126          * as well and we do not provide default values.
00127          * @param _thrFlags Thread creation flags to be used if _create = TRUE.
00128          *        See ACE threads and pthread documentation for details.
00129          *  2006/07/06 merge two constructor, since there is almost no difference between them
00130          */
00131 //      Thread(const ACE_CString & name,
00132 //             const TimeInterval& responseTime,
00133 //             const TimeInterval& sleepTime,
00134 //             const bool del,
00135 //             const long _thrFlags);
00136 
00140         virtual ~Thread();
00141 
00149         virtual void onStart(){};
00150 
00159         virtual void onStop(){};
00160 
00171         virtual void commonStart();
00172 
00183         virtual void commonStop();
00184 
00196         virtual void run();
00197 
00207         virtual void runLoop(){}
00208 
00209       protected:
00210 
00220         static  void threadSvc(void *param);
00221 
00225         ACS::ThreadManager*  getThreadManager() const;
00226 
00227         LoggingProxy *logger_mp; 
00228 
00229         ACS::ThreadManager* thrMgr_mp; 
00230       private:
00231 
00235         void operator=(const Thread&);
00236 
00240         Thread(const Thread&);
00241 
00245         bool delete_m;
00246 
00247     };//class ACS::Thread
00248 
00249 };//namespace ACS
00250 
00251 #endif

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0