summaryrefslogtreecommitdiff
path: root/lib/resource.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-03-02 10:35:21 +0100
committerMaria Matejka <mq@ucw.cz>2022-03-02 12:13:49 +0100
commit48bf1322aa141ca6259b26b37551402758cff0cc (patch)
treeb900a58ac1356bf3724cfa226070ff97df3d52d5 /lib/resource.h
parent2e8b8bfcc46ec1493f9e0efe9c796b88df85ada4 (diff)
Introducing an universal temporary linpool flushed after every task
Diffstat (limited to 'lib/resource.h')
-rw-r--r--lib/resource.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/resource.h b/lib/resource.h
index 9ec41ed8..0e4c44d8 100644
--- a/lib/resource.h
+++ b/lib/resource.h
@@ -79,6 +79,15 @@ void lp_flush(linpool *); /* Free everything, but leave linpool */
void lp_save(linpool *m, lp_state *p); /* Save state */
void lp_restore(linpool *m, lp_state *p); /* Restore state */
+extern _Thread_local linpool *tmp_linpool; /* Temporary linpool autoflushed regularily */
+
+#define tmp_alloc(sz) lp_alloc(tmp_linpool, sz)
+#define tmp_allocu(sz) lp_allocu(tmp_linpool, sz)
+#define tmp_allocz(sz) lp_allocz(tmp_linpool, sz)
+
+#define tmp_init(p) tmp_linpool = lp_new_default(p)
+#define tmp_flush() lp_flush(tmp_linpool)
+
extern const int lp_chunk_size;
#define LP_GAS 1024
#define LP_GOOD_SIZE(x) (((x + LP_GAS - 1) & (~(LP_GAS - 1))) - lp_chunk_size)