/* * Copyright (C) 2023-present ScyllaDB */ /* * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0 */ #pragma once #include #include #include #include #include #include #include #include "rust/cxx.h" #include "rust/wasmtime_bindings.hh" namespace wasm { struct wasm_compile_task { seastar::noncopyable_function func; seastar::promise>& done; unsigned shard; }; struct task_queue { std::mutex _mut; std::condition_variable _cv; std::queue> _pending; public: std::optional pop_front(); void push_back(std::optional work_item); }; class alien_thread_runner { task_queue _pending_queue; std::thread _thread; public: alien_thread_runner(); ~alien_thread_runner(); alien_thread_runner(const alien_thread_runner&) = delete; alien_thread_runner& operator=(const alien_thread_runner&) = delete; void submit(seastar::promise>& p, std::function()> f); }; } // namespace wasm