Home Libraries Author Links

Abstract Data Type Family StmThreadSpecific<ItemType>
[Unique: System-unique Singletons and Thread-specific Data]

Collaboration diagram for Abstract Data Type Family StmThreadSpecific<ItemType>:

Detailed Description

StmThreadSpecific<ItemType> is an abstract data type for thread-specific items of abstract data type ItemType.

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.


Modules

 StmThreadSpecific<ItemType> Example
 Example of an abstract thread-specific type with the abstract item type SampleStateType.

Defines

#define StmThreadSpecificItemDefine(ItemType)   StmThreadSpecificItemImpl_ (ItemType)
 Definition of the abstract data type StmThreadSpecificItemType providing a thread-specific item of the abstract data type ItemType.


Define Documentation

#define StmThreadSpecificItemDefine ( ItemType   )     StmThreadSpecificItemImpl_ (ItemType)

Definition of the abstract data type StmThreadSpecificItemType providing a thread-specific item of the abstract data type ItemType.

Parameters:
[in] ItemType Abstract data type of the thread-specific item.
Requires:
ItemType is an abstract data type (see StmAbstractType). That means ItemType is convertible to and from void* and has an accompanying type ConstItemType.
ItemType has a method function named ItemTypeDestroy taking a single argument of type ItemType.
Note:
For an example documenting all method functions of the abstract thread-specific type StmThreadSpecificSampleStateType for the ItemType SampleStateType type see StmThreadSpecific<ItemType> Example.

Definition at line 198 of file unique.h.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).