Disponible
amalgame-threading
Mutex, Channel, Thread.Spawn — wrap pthread.
Vue d'ensemble
Primitives de concurrence cross-OS : threads, mutex, channels FIFO bornés. Wrap pthread sous Linux/macOS et Win32 Threads sous Windows. Enregistrement thread-safe pour le GC Boehm. C'est la couche qui rend possible le worker pool de Mosaic.
Caractéristiques
- ✓
Thread.Spawn(fn)/Join()/Sleep(ms) - ✓
Mutex.New(),Lock(),Unlock() - ✓
Channel<T>.New(capacity)FIFO borné - ✓Condition variables internes pour
Channel - ✓Enregistrement GC-safe sous pthread/Win32
Exemple
Exemple minimal d'utilisation — recopiable tel quel après l'install.
amc package add threading
let ch = Channel<int>.New(16)
Thread.Spawn(fn() {
for i in 0..10 { ch.Send(i) }
ch.Close()
})
while let v = ch.Recv() {
Console.WriteLine(v)
}
En bref
- Licence : Apache-2.0
- Installation :
amc package add threading - Code source : amalgame-lang/amalgame-threading
- Index officiel : amalgame-lang/packages-index