Class Poco::ThreadLocal
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco

# template < class C >

# class ThreadLocal

Library: Foundation
Package: Threading
Header: Poco/ThreadLocal.h

## Description

This template is used to declare type safe thread local variables. It can basically be used like a smart pointer class with the special feature that it references a different object in every thread. The underlying object will be created when it is referenced for the first time. See the NestedDiagnosticContext class for an example how to use this template. Every thread only has access to its own thread local data. There is no way for a thread to access another thread's local data.

## Member Summary

Member Functions: get, operator *, operator->

## Constructors

### ThreadLocal

ThreadLocal();

## Destructor

### ~ThreadLocal

~ThreadLocal();

## Member Functions

### get

C & get();

Returns a reference to the underlying data object. The reference can be used to modify the object.

### operator *

C & operator * ();

"Dereferences" the smart pointer and returns a reference to the underlying data object. The reference can be used to modify the object.

### operator->

C * operator-> ();