1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGHARDWARECONTEXTTHREAD_H_
40 #define _OSGHARDWARECONTEXTTHREAD_H_
45 #include "OSGBaseDef.h"
46 #include "OSGThread.h"
47 #include "OSGHardwareContextTask.h"
51 class HardwareContext
;
53 /*! \ingroup GrpBaseMemoryObjectsBase
54 \ingroup GrpBaseHardwareContext
55 \ingroup GrpLibOSGBase
58 class OSG_BASE_DLLMAPPING HardwareContextThread
: public Thread
61 /*========================== PUBLIC =================================*/
65 OSG_GEN_INTERNAL_MEMOBJPTR(HardwareContextThread
);
67 /*---------------------------------------------------------------------*/
68 /*! \name Reference Counting */
71 static ObjTransitPtr
get (Char8
*szName
, bool bGlobal
);
72 static HardwareContextThread
*find(Char8
*szName
);
74 /*---------------------------------------------------------------------*/
75 /*! \name Reference Counting */
78 bool isRunning (void );
79 void endRunning(void );
82 /*---------------------------------------------------------------------*/
83 /*! \name Constructors */
86 void queueTask (HardwareContextTask
*pTask
);
87 void queueTaskFront(HardwareContextTask
*pTask
);
90 /*---------------------------------------------------------------------*/
91 /*! \name Debugging, don't use */
98 /*========================= PROTECTED ===============================*/
102 typedef Thread Inherited
;
104 static MPThreadType _type
;
108 HardwareContextTaskQueue _qTaskQueue
;
109 HardwareContext
*_pContext
;
111 /*---------------------------------------------------------------------*/
112 /*! \name Reference Counting */
115 static BaseThread
*create(const Char8
*szName
,
120 /*---------------------------------------------------------------------*/
121 /*! \name Constructors */
124 HardwareContextThread(const Char8
*szName
, UInt32 uiId
, bool bGlobal
);
127 /*---------------------------------------------------------------------*/
128 /*! \name Destructor */
131 virtual ~HardwareContextThread(void);
134 /*---------------------------------------------------------------------*/
135 /*! \name Destructor */
138 virtual void workProc(void);
141 /*---------------------------------------------------------------------*/
142 /*! \name Constructors */
145 void setContext(HardwareContext
*pContext
);
148 /*========================== PRIVATE ================================*/
152 friend class HardwareContext
;
154 /*!\brief prohibit default function (move to 'public' if needed) */
155 HardwareContextThread(const HardwareContextThread
&source
);
156 void operator =(const HardwareContextThread
&source
);
159 OSG_GEN_MEMOBJPTR(HardwareContextThread
);
163 #include "OSGHardwareContextThread.inl"
165 #endif /* _OSGHARDWARECONTEXTTHREAD_H_ */