MCPcopy Index your code
hub / github.com/RustPython/RustPython / CreateEventW

Function CreateEventW

crates/vm/src/stdlib/_winapi.rs:1233–1261  ·  view source on GitHub ↗
(
        security_attributes: isize, // Always NULL (0)
        manual_reset: bool,
        initial_state: bool,
        name: Option<PyStrRef>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

1231 /// CreateEventW - Create or open a named or unnamed event object.
1232 #[pyfunction]
1233 fn CreateEventW(
1234 security_attributes: isize, // Always NULL (0)
1235 manual_reset: bool,
1236 initial_state: bool,
1237 name: Option<PyStrRef>,
1238 vm: &VirtualMachine,
1239 ) -> PyResult<WinHandle> {
1240 use windows_sys::Win32::System::Threading::CreateEventW as WinCreateEventW;
1241
1242 let _ = security_attributes; // Ignored, always NULL
1243
1244 let name_wide = name.map(|n| n.as_wtf8().to_wide_with_nul());
1245 let name_ptr = name_wide.as_ref().map_or(null(), |n| n.as_ptr());
1246
1247 let handle = unsafe {
1248 WinCreateEventW(
1249 null(),
1250 i32::from(manual_reset),
1251 i32::from(initial_state),
1252 name_ptr,
1253 )
1254 };
1255
1256 if handle.is_null() {
1257 return Err(vm.new_last_os_error());
1258 }
1259
1260 Ok(WinHandle(handle))
1261 }
1262
1263 /// SetEvent - Set the specified event object to the signaled state.
1264 #[pyfunction]

Callers 4

py_newMethod · 0.85
CreateEventFunction · 0.85
exec_queryFunction · 0.85
new_with_handleMethod · 0.85

Calls 8

WinHandleClass · 0.85
to_wide_with_nulMethod · 0.80
new_last_os_errorMethod · 0.80
ErrClass · 0.50
mapMethod · 0.45
as_wtf8Method · 0.45
as_refMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected