On 27 May 2012 at 10:26, Adam Preble wrote: > I don't know if I can build on Linux but I have see ways to play with the > clock and setting affinity. However, I don't know how to take the GIL > properly during destruction. What we're talking about is a shared_ptr to > an interface that was created on the Python side. I can slap GIL > acquisition in the destructor but I know I'm not wrapping all the logic > that goes on to the Python runtime that way for freeing the object. Do you > know how that would be done?
Sure. Get the smart pointer to context the GIL for you. It's what I do in my code. I have a policy constructed smart pointer, so it's fairly straightforward to have it call a magic virtual function just before destruction. That basically upcalls down the inheritance tree to prepare the object for destruction, effectively zombiefying it. > In the meanwhile I'm looking at the Stackless examples that relate to how > CCP games said they did their engine. If I can make it work, it would mean > all Python stuff gets scheduled on one thread. I am not entirely sure > about object destruction though. Generally it's easiest to keep python on a single thread, except as a method to do async i/o. All that reference counting is deadly across CPU cores for cache coherency. Increasingly actually I'm finding myself not using threads in my new code. SMP has hard scaling limits, and threads only work well inside a SMP node, not across them. I'm finding myself using more and more batch processing in my new code, it scales wonderfully. Niall -- Technology & Consulting Services - ned Productions Limited. http://www.nedproductions.biz/. VAT reg: IE 9708311Q. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/ _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig