diff --git a/tokio/ffi/runtime.h b/tokio/ffi/runtime.h new file mode 100644 index 000000000..e80556d83 --- /dev/null +++ b/tokio/ffi/runtime.h @@ -0,0 +1,41 @@ +#include + +struct RuntimeHooks { + void (*on_thread_park)(void); + + void (*on_thread_unpark)(void); + + void (*on_thread_start)(void); + + void (*on_thread_stop)(void); +}__attribute__((__packed__)); + +struct RuntimeOptions { + bool enable_time; + bool enable_io; + + uint32_t event_interval; + uint32_t global_queue_interval; + + size_t max_blocking_threads; + + size_t max_io_events_per_tick; + + uint8_t runtime_kind; + + bool start_paused; + + struct timespec *thread_keep_alive; + + struct RuntimeHooks *runtime_hooks; + + char *thread_name; + + char *(*thread_name_fn)(void); + + size_t thread_stack_size; + + size_t worker_threads; +}__attribute__((__packed__)); + +struct Runtime; \ No newline at end of file diff --git a/tokio/ffi/task.h b/tokio/ffi/task.h index 1c374527b..c6973531c 100644 --- a/tokio/ffi/task.h +++ b/tokio/ffi/task.h @@ -1,10 +1,23 @@ +struct RawWakerVTable { + void (*clone)(void *); + + void (*wake)(void *); + + void (*wake_by_ref)(void *); + + void (*drop)(void *); +} __attribute__((__packed__)); + +struct Waker { + void *data; +}; + struct Context { - void (*wake) (void*); }; struct Task { - void* data; - void* (*poll) (void*); + void *data; + }; diff --git a/tokio/ffi/tokio.h b/tokio/ffi/tokio.h deleted file mode 100644 index defbac42f..000000000 --- a/tokio/ffi/tokio.h +++ /dev/null @@ -1,51 +0,0 @@ -#include - -struct RuntimeUnstableOptions { - // unstable - bool enable_metrics_poll_count_histogram; - // unstable - size_t metrics_poll_count_histogram_buckets; - // unstable - struct timespec metrics_poll_count_histogram_resolution; - - // unstable - uint8_t unhandled_panic; -}; - -struct RuntimeHooks { - void (*on_thread_park) (void); - void (*on_thread_unpark) (void); - void (*on_thread_start) (void); - void (*on_thread_stop) (void); -}; - -struct RuntimeOptions { - // unstable - bool disable_lifo_slot; - - bool enable_time; - bool enable_io; - - uint32_t event_interval; - uint32_t global_queue_interval; - - size_t max_blocking_threads; - - size_t max_io_events_per_tick; - - uint8_t runtime_kind; - - // todo rng_seed - - bool start_paused; - - struct timespec thread_keep_alive; - - char* thread_name; - char* (*thread_name_fn) (void); - size_t thread_stack_size; - - size_t worker_threads; -}; - -struct Runtime; \ No newline at end of file