mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 16:39:38 +08:00
wait_handle.rs: implement Rusty set_status_and_complete
This function didn't exists in LastC++11 but given that "status" is private I did not see an obvious alternative.
This commit is contained in:
parent
141dcde498
commit
da45bfab6b
@ -14,7 +14,8 @@ mod wait_handle_ffi {
|
||||
internal_job_id: u64,
|
||||
base_name: &CxxWString,
|
||||
) -> Box<WaitHandleRefFFI>;
|
||||
fn set_status_and_complete(self: &mut WaitHandleRefFFI, status: i32);
|
||||
#[cxx_name = "set_status_and_complete"]
|
||||
fn set_status_and_complete_ffi(self: &mut WaitHandleRefFFI, status: i32);
|
||||
|
||||
type WaitHandleStoreFFI;
|
||||
fn new_wait_handle_store_ffi() -> Box<WaitHandleStoreFFI>;
|
||||
@ -46,10 +47,8 @@ impl WaitHandleRefFFI {
|
||||
&mut self.0
|
||||
}
|
||||
|
||||
fn set_status_and_complete(self: &mut WaitHandleRefFFI, status: i32) {
|
||||
let wh = self.from_ffi();
|
||||
assert!(!wh.is_completed(), "wait handle already completed");
|
||||
wh.status.set(Some(status));
|
||||
fn set_status_and_complete_ffi(self: &mut WaitHandleRefFFI, status: i32) {
|
||||
self.from_ffi().set_status_and_complete(status)
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +151,10 @@ impl WaitHandle {
|
||||
pub fn is_completed(&self) -> bool {
|
||||
self.status.get().is_some()
|
||||
}
|
||||
pub fn set_status_and_complete(&self, status: i32) {
|
||||
assert!(!self.is_completed(), "wait handle already completed");
|
||||
self.status.set(Some(status));
|
||||
}
|
||||
}
|
||||
|
||||
impl WaitHandle {
|
||||
|
Loading…
x
Reference in New Issue
Block a user