0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00
bird/lib/runtime.c

35 lines
745 B
C
Raw Normal View History

/*
* 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"
2024-08-28 13:29:07 +00:00
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();
}