X11: Fix super fun race conditions (#554)
* X11: Fix super fun race conditions * Fix build on rustc<1.26
This commit is contained in:
parent
8891cfd85e
commit
262490d074
3 changed files with 39 additions and 24 deletions
|
|
@ -5,12 +5,20 @@ use std::sync::Arc;
|
|||
use std::os::raw::c_char;
|
||||
use std::ffi::{CStr, CString, IntoStringError};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use super::{ffi, util, XConnection, XError};
|
||||
|
||||
lazy_static! {
|
||||
static ref GLOBAL_LOCK: Mutex<()> = Default::default();
|
||||
}
|
||||
|
||||
unsafe fn open_im(
|
||||
xconn: &Arc<XConnection>,
|
||||
locale_modifiers: &CStr,
|
||||
) -> Option<ffi::XIM> {
|
||||
let _lock = GLOBAL_LOCK.lock();
|
||||
|
||||
// XSetLocaleModifiers returns...
|
||||
// * The current locale modifiers if it's given a NULL pointer.
|
||||
// * The new locale modifiers if we succeeded in setting them.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue