| ... | ... | @@ -82,9 +82,9 @@ pub const Mutex = switch(builtin.os) { |
| 82 | 82 | }; |
| 83 | 83 | } |
| 84 | 84 | |
| 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 | 86 | if (Context) |ctx| { |
| 87 | | var mutex = @ptrCast(*?windows.CRITICAL_SECTION, ctx); |
| 87 | var mutex = @ptrCast(*?windows.CRITICAL_SECTION, @alignCast(8, ctx)); |
| 88 | 88 | if (mutex.* == null) { |
| 89 | 89 | var lock: windows.CRITICAL_SECTION = undefined; |
| 90 | 90 | windows.InitializeCriticalSection(&lock); |
| ... | ... | @@ -105,7 +105,8 @@ pub const Mutex = switch(builtin.os) { |
| 105 | 105 | if (self.lock) |*lock| { |
| 106 | 106 | windows.EnterCriticalSection(lock); |
| 107 | 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 | 110 | windows.EnterCriticalSection(&self.lock.?); |
| 110 | 111 | } else { |
| 111 | 112 | @panic("unable to initialize Mutex"); |