1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 use libc::{self, BOOL, LPCSTR, HANDLE, LPSECURITY_ATTRIBUTES, CloseHandle};
14 pub type signal = HANDLE;
16 pub fn new() -> (HANDLE, HANDLE) {
18 let handle = CreateEventA(ptr::null_mut(), libc::FALSE, libc::FALSE,
24 pub fn signal(handle: HANDLE) {
25 assert!(unsafe { SetEvent(handle) != 0 });
28 pub fn close(handle: HANDLE) {
29 assert!(unsafe { CloseHandle(handle) != 0 });
33 fn CreateEventA(lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
36 lpName: LPCSTR) -> HANDLE;
37 fn SetEvent(hEvent: HANDLE) -> BOOL;