API FOR ADVANCED USERS – This class template allows an application to attach one instance of a class to any thread. More...
#include <ilserver/ilthread.h>
Public Member Functions | |
DataType * | getContext (IlsBoolean=IlsFalse) |
This member function behaves like the function Get() . More... | |
IlsBoolean | setContext (DataType *, IlsContextTerminatedFunc=0) |
This member function behaves like the function Set() . More... | |
Static Public Member Functions | |
static DataType * | Get (IlsBoolean=IlsFalse) |
This static member function retrieves a context associated with a thread. More... | |
static IlsBoolean | Set (DataType *, IlsContextTerminatedFunc=0) |
This static member function associates a context with a thread. More... | |
API FOR ADVANCED USERS – This class template allows an application to attach one instance of a class to any thread.
Library: server
and mvcomp
IlsThread
.
|
static |
This static member function retrieves a context associated with a thread.
Thread contexts can be retrieved only from the current thread. The optional parameter to this function can be set to IlsTrue
to permanently remove the context from the thread. It is the responsibility of the application to delete the context returned by this function, if appropriate.
DataType* IlsThreadContext< DataType >::getContext | ( | IlsBoolean | = IlsFalse | ) |
This member function behaves like the function Get()
.
The difference is that getContext()
can be called on an instance of the class IlsThreadContext
, so that you can have more than one context per thread. When you call this function, the contexts are stored locally in the instance of IlsThreadContext
.
|
static |
This static member function associates a context with a thread.
Thread contexts can only be associated with the current thread. When you associate a context with a thread, you can add a callback which will be called when the thread exits, either by terminating its start function, or by being exited via the static member function IlsThread::ExitCurrentThread()
. It is the responsibility of the application to delete the context if necessary, either by an explicit delete
at the end of the thread start function, or by using the context callback function which passes a pointer to the context when the thread exits. If this member function returns IlsFalse
, then the context already exists. In this case, the new context is not associated with the thread.
IlsBoolean IlsThreadContext< DataType >::setContext | ( | DataType * | , |
IlsContextTerminatedFunc | = 0 |
||
) |
This member function behaves like the function Set()
.
The difference is that setContext()
can be called on an instance of the class IlsThreadContext
, so that you can have more than one context per thread. When you call this function, the contexts are stored locally in the instance of IlsThreadContext
.