Calvin Rose
73f5314141
Work on moving to mailbox abstraction.
...
Should be more efficient in the common case.
2019-12-07 12:14:16 -06:00
Calvin Rose
0e690b4fa0
Add timeout to thread/receive.
...
If provided, throws an error if no message is received before
timeout. Perhaps should return nil?.
2019-12-06 09:21:36 -06:00
Calvin Rose
c804ae9f7c
Update threads.c to avoid a deadlock.
2019-12-06 01:46:23 -06:00
Calvin Rose
dbcceefc20
Fix bad merge.
2019-12-04 22:41:30 -06:00
Calvin Rose
1a4035b02c
Merge branch 'master' into threads-3
2019-12-04 22:39:30 -06:00
Calvin Rose
e908029392
Work on thread/receive doubling as select.
2019-12-04 22:31:01 -06:00
Calvin Rose
fd4220f254
Keep single global pthread_cond_t per thread.
...
This will allow thread/select to be implemented.
Also add thread/close and close method to threads.
2019-12-04 21:44:53 -06:00
Calvin Rose
de6c3d6d70
Simplify structure JanetThread and JanetChannel.
...
Remove JanetThreadShared.
2019-12-04 21:04:43 -06:00
Calvin Rose
474bcd50a1
Add methods to threads.
2019-12-02 04:39:13 -06:00
Calvin Rose
70c8b6838d
Use make-image-dict and load-image-dict in thread/new
...
Rather than messing with janet_core_dictionary, we
instead cache the core enevironment, and pull out the
needed tables from there. This is more flexible, more correct, and
also exposes janet_resolve_core, which can be easily used from the C
API.
2019-12-02 04:15:22 -06:00
Calvin Rose
212479188a
Have separate encode and decode dicts for threads
...
This is more correct and mirrors the way marshal -> unmarshal works.
2019-12-01 21:53:39 -06:00
Calvin Rose
8f31a53276
Add thread example.
...
Also remove reference to pthread_t in the JanetThread structure.
2019-12-01 20:47:22 -06:00
Calvin Rose
6a763aac95
Work on threads.
...
Add send and receive.
2019-12-01 20:28:12 -06:00
Calvin Rose
e542ba7e4d
Fix amalg build.
2019-11-27 12:43:45 -06:00
Calvin Rose
bca0392738
First work on threading.
...
Posix only, needs to be disabled on windows. Also
the Makefile needs to be configurable, and meson.build
needs to take pthreads into account.
2019-11-26 23:13:53 -06:00