malebolgia makes it safe. But I'm thinking of an abstraction that is less ugly.
I haven't heard of `malebolgia`. I'll read about it. It's is unfortunate that
we still have to use `ptr` in `addr` because it can be dangerous
This is very useful example because now I understand how to use Isolated (at
least I think I understand) Very useful `template withMyLock`
Here is a more interesting program:
import std / [strutils, tables]
import malebolgia
import malebolgia / ticketlocks
proc countWords(filename: string; results: ptr CountTable[string]; L: ptr
TicketLock) =
for w in splitWhitespace(readFile(filename)):
w
Here is an example showing list handling via Isolated[T]:
import std / [os, locks, atomics, isolation]
type
MyList {.acyclic.} = ref object
data: string
next: Isolated[MyList]
template withMyLock*(a: Lock, body: untyped) =
acquire(a)
I wanted to ask if are there any articles about threading in Nim 2
In particular, I am interested in data sharing between threads Can I move data
between threads without copying it? I remember there was some Isolated stuff,
but it was in development
And some stuff about SharedPtr. Are there any