Repository navigation
feat(jco): Cooperative threading - #2282
TartanLlama wants to merge 3 commits into
Conversation
|
@vados-cosmonic the |
|
Hey @TartanLlama so there are basically two easy options:
Generally just to make sure things work you can do (2) then (1) -- then I'll re-enable these tests once the newer version of |
2699682 to
b37720b
Compare
vados-cosmonic
left a comment
There was a problem hiding this comment.
LGTM 🚀
This is fantastic work thanks @TartanLlama !
Most of my comments are nits (or super nits), so I'm going to get this in and we can get on our way to unskipping the tests.
Normally, consumers will not be impacted by this unless they actually opt in to using threads via how the intrinsics are puleld in so there should not be disruption there/it should be invisible other than jco-transpile being a slightly heavier build-time dep.
| // ordinary ready wait, it cannot take the immediate-completion | ||
| // shortcut. | ||
| const keepGoing = await task.immediateSuspend({{ | ||
| return thread.suspend({{ |
There was a problem hiding this comment.
🎉 Very glad to finally be rid of the pretend-single-thread machinery.
| assert!(source.contains("callingWasmExport: true,")); | ||
| assert!(source.contains("task.enterSync();")); | ||
| assert!(source.contains("return _withGlobalCurrentTaskMeta({")); | ||
| assert!(source.contains("return _withGlobalCurrentThreadMeta({")); |
There was a problem hiding this comment.
Yup thanks for updating these -- normally checking the source is silly but in this case since we're kind of doing a transpile thing/outputting the code, I figured it was not completely unreasonable.
We can delete a ton of this once the runtime is externalized.
| (None, None) | ||
| }; | ||
|
|
||
| // Wrap the realloc function to disable leaving the component state while it is executing |
There was a problem hiding this comment.
Thanks for adding this!
|
Basically everything I have here as comments is just fine in a follow-up, but left them for posterity |
322347c to
ecf1829
Compare
Implements cooperative threading primitives and adds tests for validation.
I plan on porting more of the posix test suite over in time.