]> mj.ucw.cz Git - libucw.git/blob - ucw/trans.h
More work on resource pools.
[libucw.git] / ucw / trans.h
1 /*
2  *      The UCW Library -- Transactions
3  *
4  *      (c) 2008 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #ifndef _UCW_TRANS_H
11 #define _UCW_TRANS_H
12
13 #include "ucw/mempool.h"
14
15 #include <setjmp.h>
16
17 /* Transactions */
18
19 struct trans {
20   struct trans *prev;
21   struct mempool_state trans_pool_state;
22   struct respool *res_pool;
23   jmp_buf jmp;
24 };
25
26 void trans_init(void);          // Called automatically on trans_open() if needed
27 void trans_cleanup(void);       // Free memory occupied by the transaction system pools
28
29 struct trans *trans_open(void);
30 struct trans *trans_get_current(void);
31 void trans_commit(void);
32 void trans_rollback(void);
33 void trans_dump(void);
34
35 /* Exceptions */
36
37 #endif