Skip to content

Commit

Permalink
Multiple fixes to get asyncipc working with devel on windows
Browse files Browse the repository at this point in the history
 - First was to make sure the object is  first before casting to pointer so that we are actually accessing the data (On devel this calls a converter which returns the type

 - I was running into a nil access error on ORC which I fixed by using the stdlib getGlobalDispatcher() instead
  • Loading branch information
ire4ever1190 committed May 31, 2023
1 parent 84ced6d commit dab1b6d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions asynctools/asyncipc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,10 @@ elif defined(windows):
let mapSize = size + mapMinSize

doAssert(size > mapMinSize)

let handleMap = createFileMappingW(INVALID_HANDLE_VALUE,
cast[pointer](addr sa),
PAGE_READWRITE, 0, mapSize.Dword,
cast[pointer](mapName))
cast[pointer](WideCString(mapName)))
if handleMap == 0:
raiseOSError(osLastError())
var eventChange = createEvent(addr sa, 0, 0, addr nameChange[0])
Expand Down Expand Up @@ -267,7 +266,7 @@ elif defined(windows):
interlockedOr(cast[ptr int32](data), 1)

if register:
let p = getCurrentDispatcher()
let p = getGlobalDispatcher()
p.handles.incl(AsyncFD(eventChange))

result = AsyncIpcHandle(
Expand All @@ -285,7 +284,7 @@ elif defined(windows):
interlockedAnd(cast[ptr int32](ipch.data), not(1))

if unregister:
let p = getCurrentDispatcher()
let p = getGlobalDispatcher()
p.handles.excl(AsyncFD(ipch.eventChange))

if unmapViewOfFile(ipch.data) == 0:
Expand Down

0 comments on commit dab1b6d

Please sign in to comment.