Nim-1.6 fixes (#239)
This commit is contained in:
parent
f51158da65
commit
4aaaa3379a
|
@ -323,7 +323,7 @@ when defined(windows) or defined(nimdoc):
|
||||||
AsyncFD* = distinct int
|
AsyncFD* = distinct int
|
||||||
|
|
||||||
proc hash(x: AsyncFD): Hash {.borrow.}
|
proc hash(x: AsyncFD): Hash {.borrow.}
|
||||||
proc `==`*(x: AsyncFD, y: AsyncFD): bool {.borrow.}
|
proc `==`*(x: AsyncFD, y: AsyncFD): bool {.borrow, gcsafe.}
|
||||||
|
|
||||||
proc getFunc(s: SocketHandle, fun: var pointer, guid: var GUID): bool =
|
proc getFunc(s: SocketHandle, fun: var pointer, guid: var GUID): bool =
|
||||||
var bytesRet: DWORD
|
var bytesRet: DWORD
|
||||||
|
@ -516,7 +516,7 @@ elif unixPlatform:
|
||||||
selector: Selector[SelectorData]
|
selector: Selector[SelectorData]
|
||||||
keys: seq[ReadyKey]
|
keys: seq[ReadyKey]
|
||||||
|
|
||||||
proc `==`*(x, y: AsyncFD): bool {.borrow.}
|
proc `==`*(x, y: AsyncFD): bool {.borrow, gcsafe.}
|
||||||
|
|
||||||
proc globalInit() =
|
proc globalInit() =
|
||||||
# We are ignoring SIGPIPE signal, because we are working with EPIPE.
|
# We are ignoring SIGPIPE signal, because we are working with EPIPE.
|
||||||
|
|
|
@ -571,8 +571,10 @@ proc emit[T](bus: AsyncEventBus, event: string, data: T, loc: ptr SrcLoc) =
|
||||||
|
|
||||||
# Schedule subscriber's callbacks, which are subscribed to the event.
|
# Schedule subscriber's callbacks, which are subscribed to the event.
|
||||||
for subscriber in item.subscribers:
|
for subscriber in item.subscribers:
|
||||||
|
# Nim-1.6 says: "'subscriber' is of type <lent EventBusKey> which cannot be captured as it would violate memory safety"
|
||||||
|
let subscriber_copy = subscriber
|
||||||
callSoon(proc(udata: pointer) =
|
callSoon(proc(udata: pointer) =
|
||||||
subscriber.cb(bus, event, subscriber, payload)
|
subscriber_copy.cb(bus, event, subscriber_copy, payload)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Schedule waiters which are waiting all events
|
# Schedule waiters which are waiting all events
|
||||||
|
@ -583,8 +585,10 @@ proc emit[T](bus: AsyncEventBus, event: string, data: T, loc: ptr SrcLoc) =
|
||||||
|
|
||||||
# Schedule subscriber's callbacks which are subscribed to all events.
|
# Schedule subscriber's callbacks which are subscribed to all events.
|
||||||
for subscriber in bus.subscribers:
|
for subscriber in bus.subscribers:
|
||||||
|
# Nim-1.6 says: "'subscriber' is of type <lent EventBusKey> which cannot be captured as it would violate memory safety"
|
||||||
|
let subscriber_copy = subscriber
|
||||||
callSoon(proc(udata: pointer) =
|
callSoon(proc(udata: pointer) =
|
||||||
subscriber.cb(bus, event, subscriber, payload)
|
subscriber_copy.cb(bus, event, subscriber_copy, payload)
|
||||||
)
|
)
|
||||||
|
|
||||||
template emit*[T](bus: AsyncEventBus, event: string, data: T) =
|
template emit*[T](bus: AsyncEventBus, event: string, data: T) =
|
||||||
|
|
|
@ -1642,7 +1642,7 @@ else:
|
||||||
break
|
break
|
||||||
return retFuture
|
return retFuture
|
||||||
|
|
||||||
proc acceptLoop(udata: pointer) =
|
proc acceptLoop(udata: pointer) {.gcsafe.} =
|
||||||
var
|
var
|
||||||
saddr: Sockaddr_storage
|
saddr: Sockaddr_storage
|
||||||
slen: SockLen
|
slen: SockLen
|
||||||
|
|
Loading…
Reference in New Issue