Skip to content

Commit

Permalink
Polyfill for thread.h and fix disk issue of Linux CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sepcnt committed May 19, 2024
1 parent 43cd0f7 commit 0d51264
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
id: cuda-toolkit
with:
cuda: '12.4.1'
method: 'network'
sub-packages: '["nvcc"]'
if: matrix.os != 'macOS-latest'

- name: Clippy Check
Expand Down
10 changes: 8 additions & 2 deletions src/hvm.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#include <inttypes.h>
#include <math.h>
#include <threads.h>
#ifdef _WIN32
#include <windows.h>
#include <threads.h>
#else
#include <pthread.h>
typedef pthread_t thrd_t;
typedef void* thrd_start_t;
#define thrd_create(a, b, c) pthread_create(a, NULL, b, c)
#define thrd_join(a, b) pthread_join(a, b)
#define thrd_yield() sched_yield()
#define thrd_sleep(a, b) nanosleep(a, b)
#endif
#include <stdatomic.h>
#include <stdint.h>
Expand Down Expand Up @@ -662,7 +668,7 @@ static inline void net_init(Net* net) {
// is that needed?
atomic_store(&net->itrs, 0);
atomic_store(&net->idle, 0);

// allocates global buffers
net->node_buf = malloc(G_NODE_LEN * sizeof(APair));
net->vars_buf = malloc(G_VARS_LEN * sizeof(APort));
Expand Down

0 comments on commit 0d51264

Please sign in to comment.