io_log_event(e->hook, e->data);
ev_run(e);
+ tmp_flush();
}
return !EMPTY_LIST(*l);
io_log_event(e->hook, e->data);
ev_run(e);
+ tmp_flush();
limit--;
}
uint chunk_size, threshold, total, total_large;
};
+_Thread_local linpool *tmp_linpool;
+
static void lp_free(resource *);
static void lp_dump(resource *);
static resource *lp_lookup(resource *, unsigned long);
root_pool.r.class = &pool_class;
root_pool.name = "Root";
init_list(&root_pool.inside);
+ tmp_init(&root_pool);
}
/**
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)
io_log_event(t->hook, t->data);
t->hook(t);
+ tmp_flush();
}
}
birdloop_set_current(loop);
+ tmp_init(loop->pool);
+
pthread_mutex_lock(&loop->mutex);
while (1)
{
/* sk_read() and sk_write() are called from BFD's event loop */
-int
-sk_read(sock *s, int revents)
+static inline int
+sk_read_noflush(sock *s, int revents)
{
switch (s->type)
{
}
int
-sk_write(sock *s)
+sk_read(sock *s, int revents)
+{
+ int e = sk_read_noflush(s, revents);
+ tmp_flush();
+ return e;
+}
+
+static inline int
+sk_write_noflush(sock *s)
{
switch (s->type)
{
}
}
+int
+sk_write(sock *s)
+{
+ int e = sk_write_noflush(s);
+ tmp_flush();
+ return e;
+}
+
int sk_is_ipv4(sock *s)
{ return s->af == AF_INET; }
}
s->err_hook(s, se);
+ tmp_flush();
}
void
clock_gettime(CLOCK_MONOTONIC, &bt_begin);
bt_suite_case_begin = bt_suite_begin = bt_begin;
+ resource_init();
+
return;
usage:
if (!bt_suite_result)
result = 0;
+ tmp_flush();
+
return result;
}
log_init_debug("");
log_switch(bt_verbose != 0, NULL, NULL);
- resource_init();
olock_init();
timer_init();
io_init();