Add wrapper for DBEnv.set_tx_timeout method to allow time based DB_RECOVER
[python.git] / Include / pyarena.h
blob6f191a1aa15a14dde47a1437dee50f6ef3e69a57
1 /* An arena-like memory interface for the compiler.
2 */
4 #ifndef Py_PYARENA_H
5 #define Py_PYARENA_H
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 typedef struct _arena PyArena;
13 /* PyArena_New() and PyArena_Free() create a new arena and free it,
14 respectively. Once an arena has been created, it can be used
15 to allocate memory. Once it is freed, all the memory it allocated
16 is freed and none of its pointers are valid.
18 PyArena_New() returns an arena pointer. On error, it
19 returns a negative number and sets an exception.
21 PyAPI_FUNC(PyArena *) PyArena_New(void);
22 PyAPI_FUNC(void) PyArena_Free(PyArena *);
24 PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t);
26 /* The next two routines aren't proper arena allocation routines.
27 They exist to experiment with the arena API without making wholesale
28 changes to the implementation.
30 The two functions register pointers with the arena id. These
31 are externally allocated pointers that will be freed when the
32 arena is freed. One takes a pointer allocated with malloc. The
33 other takes a PyObject that is DECREFed when the arena is freed.
35 PyAPI_FUNC(int) PyArena_AddMallocPointer(PyArena *, void *);
36 PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *);
38 #ifdef __cplusplus
40 #endif
42 #endif /* !Py_PYARENA_H */