fixed initializer and typos

master
emekoi 2018-11-27 17:43:59 +00:00
parent 35d93d22db
commit 51fff9fa82
2 changed files with 6 additions and 2 deletions

View File

@ -76,7 +76,7 @@ pub const Mutex = switch(builtin.os) {
pub fn init() Mutex { pub fn init() Mutex {
return Mutex { return Mutex {
.lock = undefined, .lock = undefined,
.init_once = undefined, .init_once = windows.INIT_ONCE_STATIC_INIT,
}; };
} }
@ -87,7 +87,7 @@ pub const Mutex = switch(builtin.os) {
) windows.BOOL { ) windows.BOOL {
var lock = @ptrCast( var lock = @ptrCast(
*windows.CRITICAL_SECTION, *windows.CRITICAL_SECTION,
@alignCast(@alignOf(*windows.CRITICAL_SECTION), ctx.?) @alignCast(@alignOf(*windows.CRITICAL_SECTION), Context.?)
); );
windows.InitializeCriticalSection(lock); windows.InitializeCriticalSection(lock);
return windows.TRUE; return windows.TRUE;

View File

@ -261,3 +261,7 @@ pub const PINIT_ONCE_FN = ?extern fn(InitOnce: *RTL_RUN_ONCE, Parameter: ?PVOID,
pub const RTL_RUN_ONCE = extern struct { pub const RTL_RUN_ONCE = extern struct {
Ptr: PVOID, Ptr: PVOID,
}; };
pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE {
.Ptr = null,
};