Hi all, recently maruel committed some changes I did in the CL #4273. Before the commit he replaced an InterlockedDecrement with a flat -- ref_count_. I had a "talk" with him on IRC about that and he told me that the atomic op was not needed because the class is not used between threads anymore. Apropos of this I shown him a class I wrote for an older project that is able to detect at runtime (sigh!) if a class is used between threads (without use of locks).
You can find the class here: https://cpplab.googlecode.com/svn/thread_assert/trunk Some example of usage: Case #1: Check that a class instance is ever used from same thread (recursion allowed) struct Shared { void foo() { TWCHECK(CriticaSectionA); ... bar(); ... } void bar() { TWCHECK(CriticaSectionA); ... } THREADWARNER(CriticaSectionA); }; Case #2: Check that a class is constructed and destroyed inside the same thread struct Shared { Shared() { TWCHECK(CTOR_DTOR_SECTION); ... } ~Shared() { TWCHECK(CTOR_DTOR_SECTION); ... } THREADWARNER(CTOR_DTOR_SECTION); }; Case #3: Two or more different threads can enter a critical section but in exclusive way (useful to check if external sync mechanism are working). struct Shared { foo() { SCOPED_TWCHECK(CriticalSectionA); ... } THREADWARNER(CriticalSectionA); }; at the moment the implementation works only on linux with the right compiler version, maurel suggest me that I can rewrite the class using functions in atomicops.h to be multi platform and to submit a proposal on this list to add the class to base. What's your opinion? Do you think is worth somehow to work on it in order to be included in base ? Regards Gaetano Mendola --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Chromium-dev" group. To post to this group, send email to chromium-dev@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/chromium-dev?hl=en -~----------~----~----~----~------~----~------~--~---