#include "mem_p.h"
#include "mutex_p.h"
#include "os_p.h"
+#include "thread_p.h"
/***
*** Functions
}
rcu_register_thread();
+ isc__thread_initialize();
isc__os_initialize();
isc__mutex_initialize();
isc__mem_initialize();
isc__mem_shutdown();
isc__mutex_shutdown();
isc__os_shutdown();
+ isc__thread_shutdown();
/* should be after isc__mem_shutdown() which calls rcu_barrier() */
rcu_unregister_thread();
}
#include <isc/urcu.h>
#include <isc/util.h>
+#include "thread_p.h"
+
#ifndef THREAD_MINSTACKSIZE
#define THREAD_MINSTACKSIZE (1024U * 1024)
#endif /* ifndef THREAD_MINSTACKSIZE */
+static struct call_rcu_data *isc__thread_call_rcu_data = NULL;
+
/*
* We can't use isc_mem API here, because it's called too early and the
* isc_mem_debugging flags can be changed later causing mismatch between flags
rcu_register_thread();
+ set_thread_call_rcu_data(isc__thread_call_rcu_data);
+
void *ret = thread_body(wrap);
- isc__iterated_hash_shutdown();
+ set_thread_call_rcu_data(NULL);
rcu_unregister_thread();
+ isc__iterated_hash_shutdown();
+
return ret;
}
pthread_yield_np();
#endif /* if defined(HAVE_SCHED_YIELD) */
}
+
+void
+isc__thread_initialize(void) {
+ isc__thread_call_rcu_data = create_call_rcu_data(0, -1);
+ set_thread_call_rcu_data(isc__thread_call_rcu_data);
+}
+
+void
+isc__thread_shutdown(void) {
+ set_thread_call_rcu_data(NULL);
+ call_rcu_data_free(isc__thread_call_rcu_data);
+}
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+#pragma once
+
+#include <isc/thread.h>
+
+/*! \file */
+
+void
+isc__thread_initialize(void);
+
+void
+isc__thread_shutdown(void);