pjohansson / inkling

Limited Rust implementation of the Ink markup/scripting language for game narratives
Other
42 stars 7 forks source link

Thread safety #1

Closed MattWoelk closed 4 years ago

MattWoelk commented 4 years ago

I switched Rc's to Arc's and RefCell's to Mutex's so that everything can be moved to a thread. I also switched one instance of into_iter() to iter() to please the new compiler's warning.

Caveat: this comes with trade-offs that this project may not want. Mutexes can deadlock if not treated will (see the implementation of PartialEq for one instance where I had to already get around that).

Also, Arc's are more expensive than Rc's.

I fully understand if this project does not want these things, but if so, enjoy! :)

pjohansson commented 4 years ago

Thank you very much for the contribution! I do not know how these things work but threading support seems like a useful feature.