Skip to content

Commit

Permalink
add warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
planetis-m committed Aug 14, 2024
1 parent 822a6ae commit 8c7af51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions threading/channels.nim
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ proc trySend*[T](c: Chan[T], src: var Isolated[T]): bool {.inline.} =

template trySend*[T](c: Chan[T], src: T): bool =
## Helper template for `trySend <#trySend,Chan[T],sinkIsolated[T]>`_.
##
## .. warning:: This template creates a new copy of `src` on each call.
## For repeated sends of the same value, consider using the `trySend`
## proc with a pre-isolated value to avoid unnecessary copying.
mixin isolate
var p = isolate(src)
trySend(c, p)
Expand Down

0 comments on commit 8c7af51

Please sign in to comment.