Skip to content

Commit a774b57

Browse files
committed
libmusl compatibility
Change-Id: I02f7f4123a8d46d0ce1cef2285ac8fcefe02dc0d
1 parent dc9a183 commit a774b57

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/arch.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,11 @@
332332
(pthread_spin_trylock(arg) == 0)
333333
#define spin_unlock(arg) pthread_spin_unlock(arg)
334334
#define spin_destroy(arg) pthread_spin_destroy(arg)
335+
#ifdef __GLIBC__
335336
#define SPIN_INITIALIZER (spin_t)(1)
337+
#else
338+
#define SPIN_INITIALIZER (spin_t)(0)
339+
#endif
336340
#endif
337341
#ifndef mutex_t
338342
// mutex
@@ -352,7 +356,12 @@
352356
#define thread_t pthread_t
353357
#define thread_cond_t pthread_cond_t
354358
#define thread_create(tid, func, args) \
355-
pthread_create((tid), NULL, (func), (args))
359+
{ \
360+
pthread_attr_t attr; \
361+
pthread_attr_init(&attr); \
362+
pthread_attr_setstacksize(&attr, 2097152); \
363+
pthread_create((tid), &attr, (func), (args)); \
364+
}
356365
#define thread_join(tid, ret) pthread_join(tid, ret)
357366
#define thread_cancel(tid) pthread_cancel(tid)
358367
#define thread_exit(code) pthread_exit(code)

0 commit comments

Comments
 (0)