Programs often need global or static variables that have different values in different threads. Since all StmThread threds share one memory space, this cannot be achieved with regular variables.
Thread-specific items of abstract data type ItemType is the answer to this need. Such thread-specific items of an abstract data type ItemType are held and managed by a StmThreadSpecificItemType object which is common to all StmThread threads of a process but holds a different ItemType object for each thread. These ItemType objects are initially NULL for each thread as they are for newly created threads. When a thread terminates, the ItemType object held by that thread is destroyed by calling its ItemTypeDestroy function.
|Example of an abstract thread-specific type with the abstract item type SampleStateType. |
|#define||StmThreadSpecificItemDefine(ItemType) StmThreadSpecificItemImpl_ (ItemType)|
|Definition of the abstract data type StmThreadSpecificItemType providing a thread-specific item of the abstract data type ItemType. |
|#define StmThreadSpecificItemDefine||(||ItemType||)||StmThreadSpecificItemImpl_ (ItemType)|
Definition of the abstract data type StmThreadSpecificItemType providing a thread-specific item of the abstract data type ItemType.
|[in]||ItemType||Abstract data type of the thread-specific item.|
© Copyright Tom Michaelis 2002-2007
Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).