PistonDevelopers / physfs-rs

Rust bindings for PhysFS
zlib License
8 stars 3 forks source link

Lock only when needed, not until context deallocation. #4

Closed ghost closed 10 years ago

ghost commented 10 years ago

Previously, the PhysFSContext struct would acquire the global PHYSFS_LOCK in its constructor and release it in its destructor, making it impossible to have multiple PhysFSContexts instantiated at the same time. Now, the lock is acquired before physfs functions are called, and released when it goes out of scope. This preserves thread-safety while allowing multiple PhysFSContexts to be created. Additionally fixes https://github.com/PistonDevelopers/physfs-rs/issues/3

ghost commented 10 years ago

Don't worry about the build failing -- I just haven't updated the .travis.yml to use rustup yet.