I have done research on current libraries. All of them make me say why? I'm about to just store a mutex in tracked and lock for any operation. Then instead of weak_ptr::expired do weak_ptr::lock and test the shared_ptr then lock the mutex inside of the erase callback?
Edit: saving thread safety for another time. could probably end up wrapping up the underlying data structure and add locking.
Show differencesHistory of post edits
#4ApEk
Posted 09 November 2012 - 07:05 PM
I have done research on current libraries. All of them make me say why? I'm about to just store a mutex in tracked and lock for any operation. Then instead of weak_ptr::expired do weak_ptr::lock and test the shared_ptr then lock the mutex inside of the erase callback?
Edit: first attempt http://code.google.c...t.hpp?name=safe
Edit: I made a new branch for thread safety, but I'm probably going to save finishing thread safety for some other time.
Edit: first attempt http://code.google.c...t.hpp?name=safe
Edit: I made a new branch for thread safety, but I'm probably going to save finishing thread safety for some other time.
#3ApEk
Posted 08 November 2012 - 10:17 PM
I have done research on current libraries. All of them make me say why? I'm about to just store a mutex in tracked and lock for any operation. Then instead of weak_ptr::expired do weak_ptr::lock and test the shared_ptr then lock the mutex inside of the erase callback?
Edit: first attempt http://code.google.com/p/nano-signal-slot/source/browse/nano_signal_slot.hpp?name=safe
Edit: first attempt http://code.google.com/p/nano-signal-slot/source/browse/nano_signal_slot.hpp?name=safe
#2ApEk
Posted 08 November 2012 - 10:17 PM
I have done research on current libraries. All of them make me say why? I'm about to just store a mutex in tracked and lock for any operation. Then instead of weak_ptr::expired do weak_ptr::lock and test the shared_ptr then lock the mutex inside of the erase callback?
Edit: first attempt http://code.google.com/p/nano-signal-slot/source/browse/nano_signal_slot.hpp?name=safe
Edit: first attempt http://code.google.com/p/nano-signal-slot/source/browse/nano_signal_slot.hpp?name=safe
#1ApEk
Posted 08 November 2012 - 08:55 PM
I have done research on current libraries. All of them make me say why? I'm about to just store a mutex in tracked and lock for any operation. Then instead of weak_ptr::expired do weak_ptr::lock and test the shared_ptr then lock the mutex inside of the erase callback?