ysbaddaden / gc

A garbage collector for Crystal
93 stars 5 forks source link

Issues when using preview_mt #22

Closed bararchy closed 2 years ago

bararchy commented 2 years ago

I was about to try and play around with the gc and got this error, it won't show if preview_mt is disabled.

In lib/immix/src/immix.cr:98:39

 98 | LibC.pthread_create(thread, attr, ->(value) {
                                        ^
Error: can't send closure to C function (closured vars: start)
ysbaddaden commented 2 years ago

I just fixed this specific issue.

There is some preliminary thread safety support (#7, #14) so allocations should be safe, but no stop-the-world (#20) making the collector unsafe, so I didn't try the preview_mt flag. As expected it still fails (with an assertion error).

bararchy commented 2 years ago

Thanks! @ysbaddaden I will def try it again :)

ysbaddaden commented 2 years ago

@bararchy I made some explorations for #20 yesterday (stop/resume the world). This piece of code will actually disappear :)