Skip to content

Commit 0d51264

Browse files
committed
Polyfill for thread.h and fix disk issue of Linux CI
1 parent 43cd0f7 commit 0d51264

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
id: cuda-toolkit
2727
with:
2828
cuda: '12.4.1'
29+
method: 'network'
30+
sub-packages: '["nvcc"]'
2931
if: matrix.os != 'macOS-latest'
3032

3133
- name: Clippy Check

src/hvm.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
#include <inttypes.h>
22
#include <math.h>
3-
#include <threads.h>
43
#ifdef _WIN32
54
#include <windows.h>
5+
#include <threads.h>
66
#else
77
#include <pthread.h>
8+
typedef pthread_t thrd_t;
9+
typedef void* thrd_start_t;
10+
#define thrd_create(a, b, c) pthread_create(a, NULL, b, c)
11+
#define thrd_join(a, b) pthread_join(a, b)
12+
#define thrd_yield() sched_yield()
13+
#define thrd_sleep(a, b) nanosleep(a, b)
814
#endif
915
#include <stdatomic.h>
1016
#include <stdint.h>
@@ -662,7 +668,7 @@ static inline void net_init(Net* net) {
662668
// is that needed?
663669
atomic_store(&net->itrs, 0);
664670
atomic_store(&net->idle, 0);
665-
671+
666672
// allocates global buffers
667673
net->node_buf = malloc(G_NODE_LEN * sizeof(APair));
668674
net->vars_buf = malloc(G_VARS_LEN * sizeof(APort));

0 commit comments

Comments
 (0)