mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
changed pointer types
This commit is contained in:
parent
bb31695fbf
commit
9385127052
@ -82,9 +82,9 @@ pub const Mutex = switch(builtin.os) {
|
||||
};
|
||||
}
|
||||
|
||||
extern fn initCriticalSection(InitOnce: *windows.PINIT_ONCE, Parameter: ?windows.PVOID, Context: ?*windows.PVOID) windows.BOOL {
|
||||
extern fn initCriticalSection(InitOnce: *windows.PINIT_ONCE, Parameter: ?windows.PVOID, Context: ?windows.PVOID) windows.BOOL {
|
||||
if (Context) |ctx| {
|
||||
var mutex = @ptrCast(*?windows.CRITICAL_SECTION, ctx);
|
||||
var mutex = @ptrCast(*?windows.CRITICAL_SECTION, @alignCast(8, ctx));
|
||||
if (mutex.* == null) {
|
||||
var lock: windows.CRITICAL_SECTION = undefined;
|
||||
windows.InitializeCriticalSection(&lock);
|
||||
@ -105,7 +105,8 @@ pub const Mutex = switch(builtin.os) {
|
||||
if (self.lock) |*lock| {
|
||||
windows.EnterCriticalSection(lock);
|
||||
} else {
|
||||
if (windows.InitOnceExecuteOnce(&self.init_once, initCriticalSection, null, @ptrCast(?*windows.PVOID, self)) == windows.TRUE) {
|
||||
var mutex = @ptrCast(?windows.PVOID, self);
|
||||
if (windows.InitOnceExecuteOnce(&self.init_once, initCriticalSection, null, mutex) == windows.TRUE) {
|
||||
windows.EnterCriticalSection(&self.lock.?);
|
||||
} else {
|
||||
@panic("unable to initialize Mutex");
|
||||
|
||||
@ -254,9 +254,9 @@ pub const RTL_CRITICAL_SECTION = extern struct {
|
||||
|
||||
pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
|
||||
|
||||
pub extern "kernel32" stdcallcc fn InitOnceExecuteOnce(InitOnce: *PINIT_ONCE, InitFn: PINIT_ONCE_FN, Context: ?PVOID, Parameter: ?*LPVOID) BOOL;
|
||||
pub extern "kernel32" stdcallcc fn InitOnceExecuteOnce(InitOnce: *PINIT_ONCE, InitFn: PINIT_ONCE_FN, Context: ?PVOID, Parameter: ?LPVOID) BOOL;
|
||||
|
||||
pub const PINIT_ONCE_FN = ?extern fn(InitOnce: *PINIT_ONCE, Parameter: ?PVOID, Context: ?*PVOID) BOOL;
|
||||
pub const PINIT_ONCE_FN = ?extern fn(InitOnce: *PINIT_ONCE, Parameter: ?PVOID, Context: ?PVOID) BOOL;
|
||||
|
||||
pub const RTL_RUN_ONCE = extern struct {
|
||||
Ptr: PVOID,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user