char *err_file_name; /* File name containing error */
char *file_name; /* Name of main configuration file */
int file_fd; /* File descriptor of main configuration file */
- int thread_count; /* How many worker threads to prefork */
+ struct thread_config threads; /* Thread settings */
struct sym_scope *root_scope; /* Scope for root symbols */
struct sym_scope *current_scope; /* Current scope where we are actually in while parsing */
void birdloop_add_socket(struct birdloop *, struct birdsock *);
void birdloop_remove_socket(struct birdloop *, struct birdsock *);
+/* Initializations */
void birdloop_init(void);
+struct thread_config {
+ uint count;
+};
+
+void bird_thread_commit(struct thread_config *new);
+
+
#endif /* _BIRD_IO_LOOP_H_ */
conf: THREADS expr {
if ($2 < 1) cf_error("Number of threads must be at least one.");
- new_config->thread_count = $2;
+ new_config->threads.count = $2;
}
}
void
-bird_thread_commit(struct config *new, struct config *old UNUSED)
+bird_thread_commit(struct thread_config *new)
{
ASSERT_DIE(birdloop_inside(&main_birdloop));
- if (new->shutdown)
- return;
-
- if (!new->thread_count)
- new->thread_count = 1;
+ if (!new->count)
+ new->count = 1;
while (1)
{
struct birdloop_pickup_group *group = &pickup_groups[0];
LOCK_DOMAIN(attrs, group->domain);
- int dif = group->thread_count - (thread_dropper_goal = new->thread_count);
+ int dif = group->thread_count - (thread_dropper_goal = new->count);
bool thread_dropper_running = !!thread_dropper;
UNLOCK_DOMAIN(attrs, group->domain);
static void cli_commit(struct config *new, struct config *old);
void
-sysdep_commit(struct config *new, struct config *old)
+sysdep_commit(struct config *new, struct config *old UNUSED)
{
if (!new->shutdown)
+ {
log_switch(0, &new->logfiles, new->syslog_name);
-
- cli_commit(new, old);
- bird_thread_commit(new, old);
+ cli_commit(new, old);
+ bird_thread_commit(&new->threads);
+ }
}
static int
void cmd_shutdown(void);
void cmd_graceful_restart(void);
void cmd_show_threads(int);
-void bird_thread_commit(struct config *new, struct config *old);
#define UNIX_DEFAULT_CONFIGURE_TIMEOUT 300
#include "conf/conf.h"
void sysdep_preconfig(struct config *c UNUSED) {}
-void bird_thread_commit(struct config *new, struct config *old);
-void sysdep_commit(struct config *new, struct config *old)
+void bird_thread_commit(struct thread_config *new);
+void sysdep_commit(struct config *new, struct config *old UNUSED)
{
- bird_thread_commit(new, old);
+ bird_thread_commit(&new->threads);
}
void sysdep_shutdown_done(void) {}