Qore Programming Language Reference Manual
1.12.0
|
A helper class for the Gate class for exception-safe Gate handling. More...
Public Member Methods | |
constructor (Gate gate) | |
Creates the AutoGate object based on the Gate argument passed and immediately calls Gate::enter() More... | |
copy () | |
Throws an exception; objects of this class cannot be copied. More... | |
destructor () | |
Calls Gate::exit() and destroys the AutoGate object. More... | |
A helper class for the Gate class for exception-safe Gate handling.
AutoGate objects, when used along with a Gate object, allow Qore programmers to safely enter and exit a Gate lock, even if exceptions are thrown or return statements are executed in the block where the AutoGate object is created.
AutoGate objects enter the gate lock for the lifetime of the AutoGate object. For this reason, it is only appropriate to assign an AutoGate object to a local variable, so when the local variable goes out of scope, the AutoGate object will be deleted and the gate automatically exited.
For example:
Qore::Thread::AutoGate::constructor | ( | Gate | gate | ) |
Creates the AutoGate object based on the Gate argument passed and immediately calls Gate::enter()
Qore::Thread::AutoGate::copy | ( | ) |
Throws an exception; objects of this class cannot be copied.
AUTOGATE-COPY-ERROR | objects of this class cannot be copied |
Qore::Thread::AutoGate::destructor | ( | ) |
Calls Gate::exit() and destroys the AutoGate object.