]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/windows/helper_signal.rs
doc: remove incomplete sentence
[rust.git] / src / libstd / sys / windows / helper_signal.rs
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.
4 //
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.
10
11 use libc::{mod, BOOL, LPCSTR, HANDLE, LPSECURITY_ATTRIBUTES, CloseHandle};
12 use ptr;
13
14 pub type signal = HANDLE;
15
16 pub fn new() -> (HANDLE, HANDLE) {
17     unsafe {
18         let handle = CreateEventA(ptr::null_mut(), libc::FALSE, libc::FALSE,
19                                   ptr::null());
20         (handle, handle)
21     }
22 }
23
24 pub fn signal(handle: HANDLE) {
25     assert!(unsafe { SetEvent(handle) != 0 });
26 }
27
28 pub fn close(handle: HANDLE) {
29     assert!(unsafe { CloseHandle(handle) != 0 });
30 }
31
32 extern "system" {
33     fn CreateEventA(lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
34                     bManualReset: BOOL,
35                     bInitialState: BOOL,
36                     lpName: LPCSTR) -> HANDLE;
37     fn SetEvent(hEvent: HANDLE) -> BOOL;
38 }