0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-13 22:58:42 +00:00
bird/lib/runtime.c
2024-08-28 15:49:13 +02:00

35 lines
745 B
C

/*
* BIRD Internet Routing Daemon -- Global runtime context
*
* (c) 2024 Maria Matejka <mq@jmq.cz>
* (c) 2024 CZ.NIC, z.s.p.o.
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#include "lib/runtime.h"
int shutting_down = 0;
struct global_runtime global_runtime_initial = {
.tf_log = {
.fmt1 = "%F %T.%3f",
},
.tf_base = {
.fmt1 = "%F %T.%3f",
},
};
struct global_runtime * _Atomic global_runtime = &global_runtime_initial;
void
switch_runtime(struct global_runtime *new)
{
new->load_time = current_time();
atomic_store_explicit(&global_runtime, new, memory_order_release);
/* We have to wait until every reader surely doesn't read the old values */
synchronize_rcu();
}