Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
syscall mod is split into more modules based on system call names

EventLoops does not perform load balancing

refactor CI
41 changes: 22 additions & 19 deletions open-coroutine-core/src/net/event_loop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,30 @@ impl EventLoops {

pub fn stop() {
warn!("open-coroutine is exiting...");
EVENT_LOOP_STARTED.store(false, Ordering::Release);
// wait for the event-loops to stop
let (lock, cvar) = EVENT_LOOP_STOP.as_ref();
let result = cvar
.wait_timeout_while(
lock.lock().unwrap(),
Duration::from_millis(30000),
|stopped| {
stopped.load(Ordering::Acquire)
< EVENT_LOOP_START_COUNT.load(Ordering::Acquire) - 1
},
)
.unwrap()
.1;
if EVENT_LOOP_STARTED
.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed)
.is_ok()
{
// wait for the event-loops to stop
let (lock, cvar) = EVENT_LOOP_STOP.as_ref();
let result = cvar
.wait_timeout_while(
lock.lock().unwrap(),
Duration::from_millis(30000),
|stopped| {
stopped.load(Ordering::Acquire)
< EVENT_LOOP_START_COUNT.load(Ordering::Acquire) - 1
},
)
.unwrap()
.1;
if result.timed_out() {
crate::error!("open-coroutine didn't exit successfully within 30 seconds !");
}
}
#[cfg(all(unix, feature = "preemptive-schedule"))]
crate::monitor::Monitor::stop();
if result.timed_out() {
crate::error!("open-coroutine didn't exit successfully within 30 seconds !");
} else {
crate::info!("open-coroutine exit successfully !");
}
crate::info!("open-coroutine exit successfully !");
}

pub fn submit_co(
Expand Down
84 changes: 0 additions & 84 deletions open-coroutine-core/src/syscall/facade.rs

This file was deleted.

93 changes: 0 additions & 93 deletions open-coroutine-core/src/syscall/io_uring.rs

This file was deleted.

90 changes: 0 additions & 90 deletions open-coroutine-core/src/syscall/mod.rs
Original file line number Diff line number Diff line change
@@ -1,96 +1,6 @@
#[cfg(target_os = "linux")]
use libc::epoll_event;
#[cfg(unix)]
use libc::{msghdr, off_t, size_t, sockaddr, socklen_t, ssize_t};
#[cfg(unix)]
use std::ffi::{c_int, c_void};

#[cfg(unix)]
pub mod common;

#[cfg(unix)]
pub mod raw;

#[cfg(unix)]
pub mod nio;

#[allow(unused_variables)]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
pub mod io_uring;

#[cfg(unix)]
pub mod state;

#[cfg(unix)]
mod facade;
#[cfg(unix)]
pub use facade::*;

#[cfg(unix)]
pub trait UnixSyscall {
/// write

extern "C" fn sendto(
&self,
fn_ptr: Option<
&extern "C" fn(
c_int,
*const c_void,
size_t,
c_int,
*const sockaddr,
socklen_t,
) -> ssize_t,
>,
fd: c_int,
buf: *const c_void,
len: size_t,
flags: c_int,
addr: *const sockaddr,
addrlen: socklen_t,
) -> ssize_t;

extern "C" fn write(
&self,
fn_ptr: Option<&extern "C" fn(c_int, *const c_void, size_t) -> ssize_t>,
fd: c_int,
buf: *const c_void,
count: size_t,
) -> ssize_t;

extern "C" fn pwrite(
&self,
fn_ptr: Option<&extern "C" fn(c_int, *const c_void, size_t, off_t) -> ssize_t>,
fd: c_int,
buf: *const c_void,
count: size_t,
offset: off_t,
) -> ssize_t;

extern "C" fn sendmsg(
&self,
fn_ptr: Option<&extern "C" fn(c_int, *const msghdr, c_int) -> ssize_t>,
fd: c_int,
msg: *const msghdr,
flags: c_int,
) -> ssize_t;
}

#[cfg(target_os = "linux")]
pub trait LinuxSyscall: UnixSyscall {
/// poll

extern "C" fn epoll_ctl(
&self,
fn_ptr: Option<&extern "C" fn(c_int, c_int, c_int, *mut epoll_event) -> c_int>,
epfd: c_int,
op: c_int,
fd: c_int,
event: *mut epoll_event,
) -> c_int;
}

#[allow(unused_imports)]
#[cfg(unix)]
pub use unix::*;

Expand Down
Loading