Previous Topic Next topic Print topic


CBL_TSTORE_CREATE

Creates a handle for and specifies the size of a thread-storage area. These values can be used in subsequent calls to CBL_TSTORE_GET. The new thread-storage area is initialized to zeroes.

Syntax:

call "CBL_TSTORE_CREATE" using    tstore-handle
                         by value tstore-size  
                         by value tstore-flags

Parameters:

  Using call prototype (see Key) Picture
tstore-handle cblt-pointer usage pointer.
tstore-size cblt-os-size picture x(4) comp-5 or pic x(8) comp-5 (64-bit native only)
tstore-flags cblt-os-flags picture x(4) comp-5 or pic x(8) comp-5 (64-bit native only)

On Entry:

tstore-size
Size of thread-storage area that will be returned to every thread that calls CBL_TSTORE_GET using the returned handle.
tstore-flags
The type of thread-storage area required:
Bit Meaning
0 Reserved, should be set to 0
1 Reserved, should be set to 0
2 0: Allocate a thread-storage handle. The handle is not independent of the calling program, and is deallocated automatically when the calling program is canceled.

1: Allocate a thread-storage handle that is independent from any calling program. If this bit is set the thread-storage handle will be closed at the end of the run-unit

Remaining bits Reserved, should be set to 0

On Exit:

tstore-handle
The thread-storage handle.
return-code
Indicates success or otherwise of the routine:
0 Successful allocation
1000 Unable to allocate thread storage handle

Comments:

CBL_TSTORE_CREATE specifies the size of the memory block that will be returned by any subsequent calls to CBL_TSTORE_GET and, optionally, associates that handle with the calling program so that when the calling program is canceled the returned handle is automatically closed. In any event the returned handle will be closed at termination of the run-unit or a call to CBL_TSTORE_CLOSE, whichever comes first.

If this thread-storage handle is not associated with a program, then the thread-storage handle is closed at the end of the run-unit.

You should ensure that this routine is called in single-threaded mode by forcing single-threaded behavior within a monitor lock, or by calling it only when initializing the application in single-threaded mode.

Previous Topic Next topic Print topic