#include <PsnCurrentActiveObject.h>
Public Methods | |
| PsnCurrentActiveObject (const PsSimulatedObject *currentActiveObject) | |
| constructor: installs currentActiveObject on top of the global context | |
| virtual | ~PsnCurrentActiveObject () |
| destructor: uninstalls the currentActiveObject | |
Static Public Methods | |
| pthread_key_t | initialisePthreadKey () |
| a function to enble correct initialisation of thread safety keys | |
| PsSimulatedObject * | getCurrentActiveObject () |
Static Public Attributes | |
| pthread_key_t | threadContextKey = PsnCurrentActiveObject::initialisePthreadKey() |
| A key for a thread to access it's own context. | |
Protected Attributes | |
| void * | _oldName |
This class is used to keep a global context indicating to the current execution thread the simulated object the thread is executing code in behalf of. This class uses the same design pattern as HeapStackTop
Definition at line 29 of file PsnCurrentActiveObject.h.
|
|
constructor: installs currentActiveObject on top of the global context
Definition at line 34 of file PsnCurrentActiveObject.cxx. References _oldName, and threadContextKey.
00035 {
00036 _oldName = pthread_getspecific( threadContextKey ) ;
00037 pthread_setspecific ( threadContextKey , currentActiveObject );
00038 }
|
|
|
destructor: uninstalls the currentActiveObject
Definition at line 40 of file PsnCurrentActiveObject.cxx. References _oldName, and threadContextKey.
00041 {
00042 pthread_setspecific ( threadContextKey , _oldName );
00043 }
|
|
|
Definition at line 46 of file PsnCurrentActiveObject.cxx. References threadContextKey. Referenced by PsInput< Type >::realConnect(), PsOutput< Type >::set(), PsGenericControlParameter< Type, AncestorClass >::set(), and PsAbstractInput< Type >::setConnectable().
00047 {
00048 return (PsSimulatedObject *) pthread_getspecific( threadContextKey ) ;
00049 }
|
|
|
a function to enble correct initialisation of thread safety keys
Definition at line 24 of file PsnCurrentActiveObject.cxx.
00025 {
00026 pthread_key_t res ;
00027 pthread_key_create( &res, NULL) ;
00028 pthread_setspecific ( res, NULL );
00029 return res ;
00030 }
|
|
|
Definition at line 47 of file PsnCurrentActiveObject.h. Referenced by PsnCurrentActiveObject(), and ~PsnCurrentActiveObject(). |
|
|
A key for a thread to access it's own context. Use should be implicit, through creation and deletion of PsnCurrentActiveObjects Definition at line 32 of file PsnCurrentActiveObject.cxx. Referenced by getCurrentActiveObject(), PsnCurrentActiveObject(), and ~PsnCurrentActiveObject(). |
| Documentation generated on Mon Nov 25 15:25:57 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |