summaryrefslogtreecommitdiff
path: root/thread_none.h
diff options
context:
space:
mode:
authorYuta Saito <kateinoigakukun@gmail.com>2022-01-16 00:37:54 +0900
committerYuta Saito <kateinoigakukun@gmail.com>2022-01-19 11:19:06 +0900
commit420622b5a793186dfa533e7702913fd5e4764e0f (patch)
tree3b56e4ef9ff26891aaa92aadd9ee9561ef50d76e /thread_none.h
parentd6d52a7d049fd802b37d0f594629bad2cdc6b8c2 (diff)
downloadruby-420622b5a793186dfa533e7702913fd5e4764e0f.tar.gz
[wasm] add no thread variant for freestanding environment
This implementation does nothing around preemptive context switching because there is no native thread.
Diffstat (limited to 'thread_none.h')
-rw-r--r--thread_none.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/thread_none.h b/thread_none.h
new file mode 100644
index 0000000000..eac2635ca7
--- /dev/null
+++ b/thread_none.h
@@ -0,0 +1,17 @@
+#ifndef RUBY_THREAD_NONE_H
+#define RUBY_THREAD_NONE_H
+
+#define RB_NATIVETHREAD_LOCK_INIT (void)(0)
+#define RB_NATIVETHREAD_COND_INIT (void)(0)
+
+// no-thread impl doesn't use TLS but define this to avoid using tls key
+// based implementation in vm.c
+#define RB_THREAD_LOCAL_SPECIFIER
+
+typedef struct native_thread_data_struct {} native_thread_data_t;
+
+typedef struct rb_global_vm_lock_struct {} rb_global_vm_lock_t;
+
+RUBY_EXTERN struct rb_execution_context_struct *ruby_current_ec;
+
+#endif /* RUBY_THREAD_NONE_H */