work around windows
This commit is contained in:
parent
56f8ff6bf3
commit
26809823ed
|
@ -32,13 +32,15 @@ proc newSignalQueue*[T](
|
||||||
maxItems: int = 0
|
maxItems: int = 0
|
||||||
): Result[SignalQueuePtr[T], ref CatchableError] =
|
): Result[SignalQueuePtr[T], ref CatchableError] =
|
||||||
## Create a signal queue compatible with Chronos async.
|
## Create a signal queue compatible with Chronos async.
|
||||||
result = success cast[ptr SignalQueue[T]](allocShared0(sizeof(SignalQueue[T])))
|
let queue = cast[ptr SignalQueue[T]](allocShared0(sizeof(SignalQueue[T])))
|
||||||
let sigRes = ThreadSignalPtr.new()
|
let sigRes = ThreadSignalPtr.new()
|
||||||
if sigRes.isErr():
|
if sigRes.isErr():
|
||||||
let msg: string = sigRes.error()
|
let msg: string = sigRes.error()
|
||||||
return failure((ref CatchableError)(msg: msg))
|
return failure((ref CatchableError)(msg: msg))
|
||||||
result[].signal = sigRes.get()
|
else:
|
||||||
result[].chan.open(maxItems)
|
queue[].signal = sigRes.get()
|
||||||
|
queue[].chan.open(maxItems)
|
||||||
|
return success(queue)
|
||||||
|
|
||||||
proc send*[T](queue: SignalQueuePtr[T], msg: T): ?!void {.raises: [].} =
|
proc send*[T](queue: SignalQueuePtr[T], msg: T): ?!void {.raises: [].} =
|
||||||
## Sends a message from a regular thread. `msg` is deep copied. May block
|
## Sends a message from a regular thread. `msg` is deep copied. May block
|
||||||
|
|
Loading…
Reference in New Issue