[thread] Synchronisation Across Multiple Condition Variables
Dear All, I'd like to ask the floor what is the best way to wait on multiple condition variables, with the first one causing the "aggregated wait" to return with some distinguishable value. --- I'm looking to achieve something akin to .NET's WaitHandle.WaitAny, or a limited Occam ALT. After a quick peak at the source, I believe this would be a non-trivial change to the library. A way around it involves sharing data and wrapping a condition, defining notify() to take a boost:condition_variable. This would notify the condition_variable argument* so that sole observers will be notified, then setting an identifier to a member field, followed by notifying the wrapped general condition itself. The new aggregated wait() would first wait for a notification from the wrapped condition, before retrieving the identifier written to the object to return. Problem is, I don't think this is particularly elegant. Another solution is using threads to wait for each boost::condition_variable, but I don't see this as practical due to obvious overhead. *However this means for notify(), observers of the sole condition have waking preference over observers of the aggregated condition, and there is no way to know if any thread has been woken (in order to determine whether to notify the wrapped boost::condition_variable). --- Thanks for reading this, and answers on a postcard appreciated ;). -- Best regards, Alex Adranghi web: www.alexadranghi.com linkedin: www.linkedin.com/in/alexadranghi mail: mail@alexadranghi.com pgp: 0x6770b73f
Hi, I'm trying to understand how the magic works for serializing an object through a base pointer. I see that a type id object is stored to be able to use a string id to look it up at runtime. Some of the real magic however seems to happen in oserializer, which is able to match a templated archive to a registered type. I think I understand the basics of it. The really weird thing, which I think is the key to instantiating all the variations of serialize() and all the known archives is in register_archive.hpp. I'd love a more detailed explanation how that part actually works. // Sebastian Karlsson
participants (2)
-
Alex Adranghi
-
Sebastian.Karlsson@mmorpgs.org