authorgravatar for emekankurumeh@outlook.comemekoi <emekankurumeh@outlook.com> 2018-11-27 01:39:37-06:00
committergravatar for emekankurumeh@outlook.comemekoi <emekankurumeh@outlook.com> 2019-01-11 09:56:35-06:00
log93851270526e71407b4225a23daa66214a4010f9
tree3e2997207144c14d96c25b36a23240182b6efc58
parentbb31695fbfbf7c808dc3fd8c3cfc0b654ed15e5e

changed pointer types


2 files changed, 6 insertions(+), 5 deletions(-)

std/mutex.zig+4-3
...@@ -82,9 +82,9 @@ pub const Mutex = switch(builtin.os) {...@@ -82,9 +82,9 @@ pub const Mutex = switch(builtin.os) {
82 };82 };
83 }83 }
8484
85 extern fn initCriticalSection(InitOnce: *windows.PINIT_ONCE, Parameter: ?windows.PVOID, Context: ?*windows.PVOID) windows.BOOL {85 extern fn initCriticalSection(InitOnce: *windows.PINIT_ONCE, Parameter: ?windows.PVOID, Context: ?windows.PVOID) windows.BOOL {
86 if (Context) |ctx| {86 if (Context) |ctx| {
87 var mutex = @ptrCast(*?windows.CRITICAL_SECTION, ctx);87 var mutex = @ptrCast(*?windows.CRITICAL_SECTION, @alignCast(8, ctx));
88 if (mutex.* == null) {88 if (mutex.* == null) {
89 var lock: windows.CRITICAL_SECTION = undefined;89 var lock: windows.CRITICAL_SECTION = undefined;
90 windows.InitializeCriticalSection(&lock);90 windows.InitializeCriticalSection(&lock);
...@@ -105,7 +105,8 @@ pub const Mutex = switch(builtin.os) {...@@ -105,7 +105,8 @@ pub const Mutex = switch(builtin.os) {
105 if (self.lock) |*lock| {105 if (self.lock) |*lock| {
106 windows.EnterCriticalSection(lock);106 windows.EnterCriticalSection(lock);
107 } else {107 } else {
108 if (windows.InitOnceExecuteOnce(&self.init_once, initCriticalSection, null, @ptrCast(?*windows.PVOID, self)) == windows.TRUE) {108 var mutex = @ptrCast(?windows.PVOID, self);
109 if (windows.InitOnceExecuteOnce(&self.init_once, initCriticalSection, null, mutex) == windows.TRUE) {
109 windows.EnterCriticalSection(&self.lock.?);110 windows.EnterCriticalSection(&self.lock.?);
110 } else {111 } else {
111 @panic("unable to initialize Mutex");112 @panic("unable to initialize Mutex");
std/os/windows/kernel32.zig+2-2
...@@ -254,9 +254,9 @@ pub const RTL_CRITICAL_SECTION = extern struct {...@@ -254,9 +254,9 @@ pub const RTL_CRITICAL_SECTION = extern struct {
254254
255pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;255pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
256256
257pub extern "kernel32" stdcallcc fn InitOnceExecuteOnce(InitOnce: *PINIT_ONCE, InitFn: PINIT_ONCE_FN, Context: ?PVOID, Parameter: ?*LPVOID) BOOL;257pub extern "kernel32" stdcallcc fn InitOnceExecuteOnce(InitOnce: *PINIT_ONCE, InitFn: PINIT_ONCE_FN, Context: ?PVOID, Parameter: ?LPVOID) BOOL;
258258
259pub const PINIT_ONCE_FN = ?extern fn(InitOnce: *PINIT_ONCE, Parameter: ?PVOID, Context: ?*PVOID) BOOL;259pub const PINIT_ONCE_FN = ?extern fn(InitOnce: *PINIT_ONCE, Parameter: ?PVOID, Context: ?PVOID) BOOL;
260260
261pub const RTL_RUN_ONCE = extern struct {261pub const RTL_RUN_ONCE = extern struct {
262 Ptr: PVOID,262 Ptr: PVOID,