1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-23 03:37:40 +00:00

Add channel marshalling.

This commit is contained in:
Calvin Rose
2022-11-10 16:32:54 -06:00
parent bfcfd58259
commit 76be8006a4
3 changed files with 48 additions and 2 deletions

View File

@@ -265,4 +265,15 @@
(ev/do-thread
(assert (ev/take ch) "channel packing bug for threaded abstracts on threaded channels."))
# marshal channels
(def ch (ev/chan 10))
(ev/give ch "hello")
(ev/give ch "world")
(def ch2 (-> ch marshal unmarshal))
(def item1 (ev/take ch2))
(def item2 (ev/take ch2))
(assert (= item1 "hello"))
(assert (= item2 "world"))
(end-suite)