From 2cf38b8662d9ace6dc400f5834e70bf4ba713a18 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Feb 2013 14:24:25 +0200 Subject: Update transaction callback documentation --- doc/manual.xhtml | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'doc/manual.xhtml') diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 52928fe..c620388 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -14429,20 +14429,26 @@ namespace odb unsigned short event, void* key, unsigned long long data); void - register_ (callback_type callback, - void* key, - unsigned short event = event_all, - unsigned long long data = 0, - transaction** state = 0); + callback_register (callback_type callback, + void* key, + unsigned short event = event_all, + unsigned long long data = 0, + transaction** state = 0); void - unregister (void* key); + callback_unregister (void* key); + + void + callback_update (void* key, + unsigned short event, + unsigned long long data = 0, + transaction** state = 0); } } -

The register_() function registers a +

The callback_register() function registers a post-commit/rollback callback. The callback argument is the function that should be called. The key argument is used by the transaction @@ -14465,7 +14471,7 @@ namespace odb primarily useful if we are interested in only one of the events (commit or rollback).

-

The unregister() function unregisters a previously +

The callback_unregister() function unregisters a previously registered callback. If the number of registered callbacks is large, then this can be a slow operation. Generally, the callback mechanism is optimized for cases where the callbacks stay @@ -14473,13 +14479,19 @@ namespace odb

Note also that you don't need to unregister a callback that has been called or auto-reset using the state argument - passed to register_(). This function does nothing + passed to callback_register(). This function does nothing if the key is not found.

+

The callback_update() function can be used to update + the event, data, and state + values of a previously registered callback. Similar to + callback_unregister(), this is a potentially slow + operation.

+

When the callback is called, it is passed the event that triggered it, as well as the key and data values that were passed to the - register_() function. Note also that the order + callback_register() function. Note also that the order in which the callbacks are called is unspecified. The rollback event can be triggered by an exception. In this case, if the callback throws, the program will be terminated.

@@ -14520,11 +14532,11 @@ class object // back. // tran_ = &transaction::current (); - tran_->register_ (&rollback, - const_cast<object*> (this), - transaction::event_rollback, - 0, - &tran_); + tran_->callback_register (&rollback, + const_cast<object*> (this), + transaction::event_rollback, + 0, + &tran_); dirty_ = false; } @@ -14544,7 +14556,7 @@ class object // the transaction. // if (tran_ != 0) - tran_->unregister (this); + tran_->callback_unregister (this); } }; -- cgit v1.1