Skip to content

Commit f721cc6

Browse files
committed
Merge branch 'master' of github.com:idealvin/coost
2 parents b630592 + c52438b commit f721cc6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/co/co.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include <time.h> // for clock_gettime
99
#else
1010
#include <sys/time.h> // for gettimeofday
11+
#ifndef __APPLE__
12+
#include <pthread_np.h> // for getting proper threadid on modern BSDs but not Mac OSX
13+
#endif
1114
#endif
1215
#endif
1316

@@ -100,7 +103,11 @@ uint32 thread_id() { return syscall(SYS_gettid); }
100103
#else /* for mac, bsd.. */
101104
uint32 thread_id() {
102105
uint64 x;
106+
#ifdef __APPLE__
103107
pthread_threadid_np(0, &x);
108+
#else
109+
x = pthread_getthreadid_np();
110+
#endif
104111
return (uint32)x;
105112
}
106113
#endif

src/co/context/arch.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@
5353
defined(__mips__)
5454
#define ARCH_MIPS
5555

56+
#elif defined(loongarch) || \
57+
defined(_loongarch) || \
58+
defined(_loongarch64) || \
59+
defined(__loongarch__)
60+
#define ARCH_LOONGARCH
61+
62+
#elif defined(riscv) || \
63+
defined(_riscv) || \
64+
defined(_riscv64) || \
65+
defined(__riscv__)
66+
#define ARCH_RISCV
67+
68+
5669
#else
5770
#error unknown arch
5871
#endif
@@ -115,6 +128,8 @@
115128
defined(__PPC64__) || \
116129
defined(__ppc64__) || \
117130
defined(__powerpc64__) || \
131+
defined(__loongarch64) || \
132+
defined(__riscv64) || \
118133
defined(_M_X64) || \
119134
defined(_M_AMD64) || \
120135
defined(_M_IA64) || \

0 commit comments

Comments
 (0)