OCILIB (C and C++ Driver for Oracle)  4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
ocilib::ThreadKey Class Reference

Static class allowing to set/get thread local storage (TLS) values for a given unique key. More...

#include <types.hpp>

Public Types

typedef POCI_THREADKEYDEST ThreadKeyFreeProc
 Thread Key callback for freeing resources.
 

Static Public Member Functions

static void Create (const ostring &name, ThreadKeyFreeProc freeProc=nullptr)
 Create a thread key object.
 
static void SetValue (const ostring &name, AnyPointer value)
 Set a thread key value.
 
static AnyPointer GetValue (const ostring &name)
 Get a thread key value.
 

Detailed Description

Static class allowing to set/get thread local storage (TLS) values for a given unique key.

This class wraps the OCILIB object handle OCI_ThreadKey and its related methods

Note
See Threads and mutexes for more details on Oracle multi-threading support

Definition at line 1292 of file types.hpp.

Member Typedef Documentation

◆ ThreadKeyFreeProc

Thread Key callback for freeing resources.

Definition at line 1302 of file types.hpp.

Member Function Documentation

◆ Create()

void ocilib::ThreadKey::Create ( const ostring name,
ThreadKeyFreeProc  freeProc = nullptr 
)
inlinestatic

Create a thread key object.

Parameters
name- Thread key name
freeProc- Thread key value destructor function
Note
Parameter freeProc is optional. It's called when the thread terminates to allow the program to deal with the thread specific value of the key

Definition at line 28 of file ThreadKey.hpp.

References ocilib::core::Check(), and OCI_ThreadKeyCreate().

◆ SetValue()

void ocilib::ThreadKey::SetValue ( const ostring name,
AnyPointer  value 
)
inlinestatic

Set a thread key value.

Parameters
name- Thread key name
value- user value to set

Definition at line 33 of file ThreadKey.hpp.

References ocilib::core::Check(), and OCI_ThreadKeySetValue().

◆ GetValue()

AnyPointer ocilib::ThreadKey::GetValue ( const ostring name)
inlinestatic

Get a thread key value.

Parameters
name- Thread key name
Returns
Thread key value on success otherwise FALSE

Definition at line 38 of file ThreadKey.hpp.

References ocilib::core::Check(), and OCI_ThreadKeyGetValue().