ocilib::ThreadKey Class Reference

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

`#include <ocilib.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. More...
static void | SetValue (const ostring &name, AnyPointer value)
| Set a thread key value. More...
static AnyPointer | GetValue (const ostring &name)
| Get a thread key value. More...

## 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 1381 of file ocilib.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 1293 of file ocilib_impl.hpp.

References ocilib::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 1298 of file ocilib_impl.hpp.

References ocilib::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 1303 of file ocilib_impl.hpp.

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