Run denali server thread.
This commit is contained in:
parent
10e536acab
commit
a5cdd23f0b
7 changed files with 104 additions and 19 deletions
|
|
@ -28,11 +28,11 @@ pub struct Task {
|
|||
id: TaskId,
|
||||
// FIXME: This only needs to be sync because of the CURRENT_EXECUTOR
|
||||
// needing to be shared between threads.
|
||||
future: Pin<Box<dyn Future<Output = ()> + Sync>>,
|
||||
future: Pin<Box<dyn Future<Output = ()> + Sync + Send>>,
|
||||
}
|
||||
|
||||
impl Task {
|
||||
pub fn new(future: impl Future<Output = ()> + Sync + 'static) -> Task {
|
||||
pub fn new(future: impl Future<Output = ()> + Sync + Send + 'static) -> Task {
|
||||
Task {
|
||||
id: TaskId::new(),
|
||||
future: Box::pin(future),
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ where
|
|||
mut byte_buffer: ByteBuffer<1024>,
|
||||
mut cap_buffer: Vec<u64>,
|
||||
reply_port_cap: Capability,
|
||||
) -> impl Future<Output = ()> + Sync {
|
||||
) -> impl Future<Output = ()> + Sync + Send {
|
||||
async move {
|
||||
let resp = self
|
||||
.handle_request(method, &mut byte_buffer, &mut cap_buffer)
|
||||
|
|
@ -134,12 +134,14 @@ where
|
|||
method_number: u64,
|
||||
byte_buffer: &mut ByteBuffer<1024>,
|
||||
cap_buffer: &mut Vec<z_cap_t>,
|
||||
) -> impl Future<Output = Result<usize, ZError>> + Sync;
|
||||
) -> impl Future<Output = Result<usize, ZError>> + Sync + Send;
|
||||
}
|
||||
|
||||
pub fn spawn_async_server_thread<T>(server: Arc<T>, executor: Arc<Mutex<Executor>>)
|
||||
pub fn spawn_async_server_thread<T>(server: Arc<T>, executor: Arc<Mutex<Executor>>) -> JoinHandle
|
||||
where
|
||||
T: AsyncYunqServer + Send + Sync + 'static,
|
||||
{
|
||||
server.server_loop(executor);
|
||||
thread::spawn(move || {
|
||||
server.server_loop(executor);
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue