Skip to content

Commit 6a35742

Browse files
Fix CI: preserve errno in Windows facade, use is_local_empty in CoroutinePool, skip preemptive on ARM
Agent-Logs-Url: https://github.com/acl-dev/open-coroutine/sessions/781aee65-5255-455a-912c-4ab565340ca8 Co-authored-by: loongs-zhang <38336731+loongs-zhang@users.noreply.github.com>
1 parent a60d251 commit 6a35742

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
PROJECT_DIR: ${{ github.workspace }}
6262
run: sh .github/workflows/ci.sh
6363
- name: Run preemptive tests
64-
if: ${{ contains(matrix.os, 'ubuntu') && !contains(matrix.target, 'loongarch64') || contains(matrix.os, 'macos') }}
64+
if: ${{ (contains(matrix.os, 'ubuntu') && !contains(matrix.target, 'loongarch64') && !contains(matrix.target, 'armv7') && !contains(matrix.target, 'thumbv7neon')) || contains(matrix.os, 'macos') }}
6565
env:
6666
CHANNEL: ${{ matrix.channel }}
6767
CROSS: ${{ !startsWith(matrix.target, 'x86_64') && contains(matrix.target, 'linux') && '1' || '0' }}

core/src/co_pool/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Drop for CoroutinePool<'_> {
7979
self.get_running_size(),
8080
"There are still tasks in progress !"
8181
);
82-
if !self.task_queue.is_empty() {
82+
if !self.task_queue.is_local_empty() {
8383
error!("Forget some tasks when closing the pool");
8484
}
8585
}
@@ -188,7 +188,7 @@ impl<'p> CoroutinePool<'p> {
188188

189189
/// Returns `true` if the task queue is empty.
190190
pub fn is_empty(&self) -> bool {
191-
self.task_queue.is_empty()
191+
self.task_queue.is_local_empty()
192192
}
193193

194194
/// Returns the number of tasks owned by this pool.
@@ -346,7 +346,7 @@ impl<'p> CoroutinePool<'p> {
346346
/// # Errors
347347
/// if create failed.
348348
fn try_grow(&self) -> std::io::Result<()> {
349-
if self.task_queue.is_empty() {
349+
if self.task_queue.is_local_empty() {
350350
// No task to run
351351
trace!("The coroutine pool:{} has no task !", self.name());
352352
return Ok(());

core/src/syscall/windows/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,21 @@ macro_rules! impl_facade {
8686
}
8787
}
8888
let r = self.inner.$syscall(fn_ptr, $($arg, )*);
89+
// Save errno immediately—logging and coroutine bookkeeping
90+
// call Win32 APIs (e.g. CreateFileW) that clobber GetLastError().
91+
let saved_errno = std::io::Error::last_os_error();
8992
if let Some(co) = $crate::scheduler::SchedulableCoroutine::current() {
9093
if co.running().is_err() {
9194
$crate::error!("{} change to running state failed !", co.name());
9295
}
9396
}
94-
$crate::info!("exit syscall {} {:?} {}", syscall, r, std::io::Error::last_os_error());
97+
$crate::info!("exit syscall {} {:?} {}", syscall, r, saved_errno);
98+
// Restore errno so callers see the correct error.
99+
if let Some(e) = saved_errno.raw_os_error() {
100+
$crate::syscall::set_errno(
101+
u32::try_from(e).unwrap_or_default()
102+
);
103+
}
95104
r
96105
}
97106
}

0 commit comments

Comments
 (0)