mirror of
				https://gitlab.labs.nic.cz/labs/bird.git
				synced 2024-05-11 16:54:54 +00:00 
			
		
		
		
	Protocols and tables now use the birdloop pools as primary
This commit is contained in:
		@@ -17,7 +17,7 @@
 | 
			
		||||
extern struct birdloop main_birdloop;
 | 
			
		||||
 | 
			
		||||
/* Start a new birdloop owned by given pool and domain */
 | 
			
		||||
struct birdloop *birdloop_new(pool *p, uint order, const char *name, btime max_latency);
 | 
			
		||||
struct birdloop *birdloop_new(pool *p, uint order, btime max_latency, const char *fmt, ...);
 | 
			
		||||
 | 
			
		||||
/* Stop the loop. At the end, the @stopped callback is called unlocked in tail
 | 
			
		||||
 * position to finish cleanup. Run birdloop_free() from that callback to free
 | 
			
		||||
@@ -32,6 +32,9 @@ event_list *birdloop_event_list(struct birdloop *loop);
 | 
			
		||||
/* Get birdloop's time heap */
 | 
			
		||||
struct timeloop *birdloop_time_loop(struct birdloop *loop);
 | 
			
		||||
 | 
			
		||||
/* Get birdloop's pool */
 | 
			
		||||
pool *birdloop_pool(struct birdloop *loop);
 | 
			
		||||
 | 
			
		||||
/* Enter and exit the birdloop */
 | 
			
		||||
void birdloop_enter(struct birdloop *loop);
 | 
			
		||||
void birdloop_leave(struct birdloop *loop);
 | 
			
		||||
 
 | 
			
		||||
@@ -64,13 +64,19 @@ rp_new(pool *p, const char *name)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pool *
 | 
			
		||||
rp_newf(pool *p, const char *fmt, ...)
 | 
			
		||||
rp_vnewf(pool *p, const char *fmt, va_list args)
 | 
			
		||||
{
 | 
			
		||||
  pool *z = rp_new(p, NULL);
 | 
			
		||||
  z->name = mb_vsprintf(p, fmt, args);
 | 
			
		||||
  return z;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pool *
 | 
			
		||||
rp_newf(pool *p, const char *fmt, ...)
 | 
			
		||||
{
 | 
			
		||||
  va_list args;
 | 
			
		||||
  va_start(args, fmt);
 | 
			
		||||
  z->name = mb_vsprintf(p, fmt, args);
 | 
			
		||||
  pool *z = rp_vnewf(p, fmt, args);
 | 
			
		||||
  va_end(args);
 | 
			
		||||
 | 
			
		||||
  return z;
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,8 @@
 | 
			
		||||
 | 
			
		||||
#include "lib/lists.h"
 | 
			
		||||
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
 | 
			
		||||
struct resmem {
 | 
			
		||||
  size_t effective;			/* Memory actually used for data storage */
 | 
			
		||||
  size_t overhead;			/* Overhead memory imposed by allocator strategies */
 | 
			
		||||
@@ -60,6 +62,7 @@ void *ralloc(pool *, struct resclass *);
 | 
			
		||||
 | 
			
		||||
pool *rp_new(pool *, const char *);		/* Create a new pool */
 | 
			
		||||
pool *rp_newf(pool *, const char *, ...);	/* Create a new pool with a formatted string as its name */
 | 
			
		||||
pool *rp_vnewf(pool *, const char *, va_list);	/* Create a new pool with a formatted string as its name */
 | 
			
		||||
void rp_init(pool *, const char *);		/* Init a new pool */
 | 
			
		||||
void rp_initf(pool *, const char *, ...);	/* Init a new pool with a formatted string as its name */
 | 
			
		||||
static inline void rp_free(pool *p) { rfree(&p->r); }	/* Free the whole pool */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user