Trying to run the following code:
require 'chunky_png'
ractor = Ractor.new { ChunkyPNG::Canvas.from_file("some_image.png") }
img = ractor.take
# do something with img...
results in a Ractor::IsolationError saying that some constant is non-shareable. To work around this, I had to manually freeze any constants that were accessed by the call. These were the ones I had to freeze for this specific example (i.e. putting this code at the top allows the example to run):
ChunkyPNG::Chunk::CHUNK_TYPES.freeze
ChunkyPNG::EXTRA_BYTE.freeze
I haven't messed around with any of the other functions yet, so I'm sure there are other non-frozen constants in the library that may need to be frozen to allow some methods to work with Ractors.
Trying to run the following code:
results in a
Ractor::IsolationErrorsaying that some constant is non-shareable. To work around this, I had to manually freeze any constants that were accessed by the call. These were the ones I had to freeze for this specific example (i.e. putting this code at the top allows the example to run):I haven't messed around with any of the other functions yet, so I'm sure there are other non-frozen constants in the library that may need to be frozen to allow some methods to work with Ractors.