Skip to content

Commit

Permalink
Merge branch 'master' of github.com:idealvin/coost
Browse files Browse the repository at this point in the history
  • Loading branch information
idealvin committed Sep 4, 2024
2 parents b630592 + c52438b commit f721cc6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/co/co.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <time.h> // for clock_gettime
#else
#include <sys/time.h> // for gettimeofday
#ifndef __APPLE__
#include <pthread_np.h> // for getting proper threadid on modern BSDs but not Mac OSX
#endif
#endif
#endif

Expand Down Expand Up @@ -100,7 +103,11 @@ uint32 thread_id() { return syscall(SYS_gettid); }
#else /* for mac, bsd.. */
uint32 thread_id() {
uint64 x;
#ifdef __APPLE__
pthread_threadid_np(0, &x);
#else
x = pthread_getthreadid_np();
#endif
return (uint32)x;
}
#endif
Expand Down
15 changes: 15 additions & 0 deletions src/co/context/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@
defined(__mips__)
#define ARCH_MIPS

#elif defined(loongarch) || \
defined(_loongarch) || \
defined(_loongarch64) || \
defined(__loongarch__)
#define ARCH_LOONGARCH

#elif defined(riscv) || \
defined(_riscv) || \
defined(_riscv64) || \
defined(__riscv__)
#define ARCH_RISCV


#else
#error unknown arch
#endif
Expand Down Expand Up @@ -115,6 +128,8 @@
defined(__PPC64__) || \
defined(__ppc64__) || \
defined(__powerpc64__) || \
defined(__loongarch64) || \
defined(__riscv64) || \
defined(_M_X64) || \
defined(_M_AMD64) || \
defined(_M_IA64) || \
Expand Down

0 comments on commit f721cc6

Please sign in to comment.