Qore Programming Language  0.9.16
ThreadCleanupList Class Reference

list of functions to be run when a thread ends; required for some external libraries that require explicit cleanup when a thread terminates More...

#include <qore_thread.h>

Public Member Methods

DLLEXPORT void pop (bool exec=true)
 must only be called in the module destructor/deletion function More...
 
DLLEXPORT void push (qtdest_t func, void *arg)
 must only be called in the module initialization function More...
 

Detailed Description

list of functions to be run when a thread ends; required for some external libraries that require explicit cleanup when a thread terminates

this list is not locked and therefore the ThreadCleanupList::push() and ThreadCleanupList::pop() functions must only be called in module initialization and module deletion. However this list is implemented in such a way that thread cleanup list execution may be safely called interally while push() is being executed in a module initialization function, for example.

Note
this is a global object and not an attribute of a thread

Member Function Documentation

◆ pop()

DLLEXPORT void ThreadCleanupList::pop ( bool  exec = true)

must only be called in the module destructor/deletion function

Parameters
execif true the cleanup function will be executed immediately, if false it will not

◆ push()

DLLEXPORT void ThreadCleanupList::push ( qtdest_t  func,
void *  arg 
)

must only be called in the module initialization function

Parameters
functhe cleanup function to be run whenever a thread ends
argthe argument to the function (can be 0)

The documentation for this class was generated from the following file: