Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[xsrc/trunk]: xsrc/external/mit/MesaLib/dist/src/util Apply u_queue.c patch f...
details: https://anonhg.NetBSD.org/xsrc/rev/0cbeab8c0a49
branches: trunk
changeset: 10397:0cbeab8c0a49
user: maya <maya%NetBSD.org@localhost>
date: Tue Sep 24 19:47:33 2019 +0000
description:
Apply u_queue.c patch from pkgsrc:
atexit is not a good idea in shared libraries.
attempt to port cpuset logic to netbsd
diffstat:
external/mit/MesaLib/dist/src/util/u_queue.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diffs (64 lines):
diff -r e9be09365c15 -r 0cbeab8c0a49 external/mit/MesaLib/dist/src/util/u_queue.c
--- a/external/mit/MesaLib/dist/src/util/u_queue.c Tue Sep 24 19:45:13 2019 +0000
+++ b/external/mit/MesaLib/dist/src/util/u_queue.c Tue Sep 24 19:47:33 2019 +0000
@@ -48,15 +48,22 @@
static struct list_head queue_list;
static mtx_t exit_mutex = _MTX_INITIALIZER_NP;
+#define HAVE_NOATEXIT
+#if defined(HAVE_NOATEXIT)
static int global_init_called = 0;
static void __attribute__((__destructor__))
+#else
+static void
+#endif
atexit_handler(void)
{
struct util_queue *iter;
+#if defined(HAVE_NOATEXIT)
if (!global_init_called)
return;
+#endif
mtx_lock(&exit_mutex);
/* Wait for all queues to assert idle. */
@@ -70,7 +77,11 @@
global_init(void)
{
LIST_INITHEAD(&queue_list);
+#if defined(HAVE_NOATEXIT)
global_init_called = 1;
+#else
+ atexit(atexit_handler);
+#endif
}
static void
@@ -251,12 +262,25 @@
/* Don't inherit the thread affinity from the parent thread.
* Set the full mask.
*/
+#if defined(__NetBSD__)
+ cpuset_t *cpuset;
+ cpuset = cpuset_create();
+ if (cpuset != NULL) {
+ cpuset_zero(cpuset);
+ for (unsigned i = 0; i < cpuset_size(cpuset); i++)
+ cpuset_set(i, cpuset);
+
+ pthread_setaffinity_np(pthread_self(), cpuset_size(cpuset), cpuset);
+ cpuset_destroy(cpuset);
+ }
+#else
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
for (unsigned i = 0; i < CPU_SETSIZE; i++)
CPU_SET(i, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
+#endif
}
#endif
Home |
Main Index |
Thread Index |
Old Index