All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AbstractThreadResource Class Referenceabstract

base class for saving data using Qore's thread resource management system More...

`#include <AbstractThreadResource.h>`

Inheritance diagram for AbstractThreadResource:
[legend]
Collaboration diagram for AbstractThreadResource:
[legend]

## Public Member Functions

DLLEXPORT | AbstractThreadResource ()
| the constructor is currently empty
virtual DLLEXPORT | ~AbstractThreadResource ()
| virtual destructor
virtual void | cleanup (ExceptionSink *xsink)=0
| this function is called when a thread terminates and a thread resource is still allocated to the thread
virtual DLLLOCAL QoreProgram * | getProgram ()
| this function is called when clearing thread resources for a particular Program when being destroyed
Public Member Functions inherited from AbstractPrivateData
virtual DLLLOCAL void | deref (ExceptionSink *xsink)
| decrements the reference count of the object More...
virtual DLLLOCAL void | deref ()
| decrements the reference count of the object without the possibility of throwing a Qore-language exception
DLLLOCAL void | ref ()
| increments the reference count of the object More...
Public Member Functions inherited from QoreReferenceCounter
DLLEXPORT | QoreReferenceCounter ()
| creates the reference counter object
DLLEXPORT | ~QoreReferenceCounter ()
| destroys the reference counter object
DLLLOCAL bool | is_unique () const
| returns true if the reference count is 1 More...
DLLLOCAL int | reference_count () const
| gets the reference count More...
DLLEXPORT bool | ROdereference () const
| atomically decrements the reference count More...
DLLEXPORT void | ROreference () const
| atomically increments the reference count

## Additional Inherited Members

Protected Member Functions inherited from AbstractPrivateData
virtual DLLLOCAL | ~AbstractPrivateData ()
| as these objects are reference counted, the destructor should be called only when the reference count = 0 and not manually
Protected Attributes inherited from QoreReferenceCounter
QoreThreadLock | mRO
| pthread lock to ensure atomicity of updates for architectures where we don't have an atomic increment and decrement implementation

## Detailed Description

base class for saving data using Qore's thread resource management system

Thread resources are resources that are tied to a particular thread. Qore provides the ability to call the object's "cleanup()" function if the resource is still allocated to the thread when the thread terminates. For example, the Datasource transaction lock is implemented as a thread resource. If the used does not commit or rollback an open transaction before the thread terminates, ManagedDatasource::cleanup() is run, which will throw an exception, rollback the transaction, and release the transaction lock. When a thread commits or rolls back a transaction, the thread resource is removed. Use the set_thread_resource() to set and remove_thread_resource() to remove thread resources.

See Also
  set_thread_resource()
  remove_thread_resource()

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

- include/qore/AbstractThreadResource.h (6de6cc3b438610bf03b2bec44a3d7c61f90e3165)