Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify cint root mutex #14

Closed

Commits on Feb 26, 2014

  1. Clean up the way externals are picked up.

    Same as: root-5.34.02-externals.
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    7ac7b02 View commit details
    Browse the repository at this point in the history
  2. Silence roofit banner.

    Same as root-5.28-00d-roofit-silence-static-printout.patch
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    ef0cc3e View commit details
    Browse the repository at this point in the history
  3. Specify gnu hash style.

    Same as root-5.34.00-linker-gnu-hash-style.patch.
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    3cd5017 View commit details
    Browse the repository at this point in the history
  4. Correct platform detection on mac.

    Same as root-5.32.00-detect-arch.
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    5b06a25 View commit details
    Browse the repository at this point in the history
  5. Silence warnings.

    Same as root-5.32.00-detect-arch.patch.
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    606e243 View commit details
    Browse the repository at this point in the history
  6. Use correct isnan.

    Same as root-5.30.02-fix-isnan-again.spec.
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    6d13b44 View commit details
    Browse the repository at this point in the history
  7. Fix trampolines for ARM.

    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    1b092e4 View commit details
    Browse the repository at this point in the history
  8. Thread-safe determination of TObject::IsOnHeap()

    The previous mechanism of determining TObject::IsOnHeap() was found
    to be inaccurate and thread unsafe. The new way is to fill the memory
    area returned by calls to TObject::new with a special value and
    as the first operation in TObject's constructor look to see if the
    uninitialized member data have that value set. If they do we assume
    the object was made via a call to 'new' and therefore is on the heap.
    
    The interface in TStorage used to implement the old mechanism has
    been declared obsolete via the use of ::Obsolete.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    2e422ce View commit details
    Browse the repository at this point in the history
  9. Removed use of TStorage::IsOnHeap

    This is the only use of TStorage::IsOnHeap outside of TObject constructor.
    It appears to be checking to see if the object might not be available anymore
    and if so don't talk to it. This test is highly inadequate to answer that
    question and since we want to get rid of TStorage::IsOnHeap for other reasons,
    it was decided to remove its use here.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    b22c22f View commit details
    Browse the repository at this point in the history
  10. Made TClass::fgCallingNew a thread_local file scope static

    In order to avoid thread-safety issues, the static class member
    TClass::fgCallingNew is no longer a class member and is instead
    a file scoped static declared thread_local. It was necessary to
    not have it is a class member since CINT could not parse the new
    thread_local keyword.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    e514c79 View commit details
    Browse the repository at this point in the history
  11. Don't reset global in TClass::New

    Helgrind was complaining about a global being written without a lock.
    In this case, the global is not actually changed so we do a check
    to see if the old value was the same as the value we set and if
    so, we don't bother to change it.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    f9d1a25 View commit details
    Browse the repository at this point in the history
  12. Support for C++11 in ARM builds

    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    4627669 View commit details
    Browse the repository at this point in the history
  13. Merge pull request root-project#3 from ktf/import-cms-patches

    Import cms patches
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    7925282 View commit details
    Browse the repository at this point in the history
  14. Fast and dirty version of setting special value in TObject::new

    Write special values into memory after TObject::new called in order to
    have TObject's constructor determine if the object was made on the heap.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    6001a66 View commit details
    Browse the repository at this point in the history
  15. Cleaned up TStorage changes

    Removed obsolete static member data and obsolete function bodies.
    Added ::Obsolete calls where appropriate.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    7d65924 View commit details
    Browse the repository at this point in the history
  16. Encapsulate check on alloc in TStorage::FilledByObjectAlloc

    Instead of having TObject's constructors know explicitly about how
    TStorage::ObjectAlloc works, we no encapsulate that knowledge into
    TStorage::FilledByObjectAlloc.
    Additionally, switched from fBits to fUniqueID when checking for
    assignment from 'new' in order to more easily create a valgrind
    suppression entry.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    f1f9d3b View commit details
    Browse the repository at this point in the history
  17. Added suppression entries for determining if TObject on heap

    To determine if TObject is on the heap we read the value of a member
    data before it has been set by the constructor. If it was heap
    allocated the TObject::operator new will have filled special values
    into the memory area. However, for stack allocated it is
    unset. This makes valgrind report an error. Given we intend this
    behavior, we suppress the message.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    d7e3e1b View commit details
    Browse the repository at this point in the history
  18. Make variable used for GUID of TKeys atomic

    Since TKeys can be made by different threads, it is necessary to
    protect the global used to assign the GUID of TKeys,  keyAbsNumber
    so that we are guaranteed to get a unique value for each request.
    C++11 atomics give that guarantee.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    90ab19a View commit details
    Browse the repository at this point in the history
  19. Protect Cintex structure with mutex

    The caching of TClasses by Cintext could be updated at anytime and
    therefore needs to be protected when running multi-threaded.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    3b1874a View commit details
    Browse the repository at this point in the history
  20. Make zip globals thread local

    The zip functions use globals to hold state while calling from
    function to function. Such use is not thread safe. Given the globals
    are only used during a function call chain, it is safe to change them
    to thread local. Given this is compiled by a C compiler, we must use
    the gcc specific __thread keyword.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    11b1179 View commit details
    Browse the repository at this point in the history
  21. Protect access to TROOT::GetListOfFiles()

    When new files are opened or closed, gROOT->GetListOfFiles() is updated.
    If the opening/closing happens on different threads then we need to
    serialize all access to that list. This changes uses gROOTMutex to
    serialize those accesses.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    6517b5e View commit details
    Browse the repository at this point in the history
  22. Protected threaded access to TClass::GetStreamerInfos()

    The list of TStreamerInfos held by a TClass can change while processing
    and therefore access to it must be protected when using multiple threads.
    The gCINTMutex is used for this purpose since the TClass is considered
    part of the CINT data model.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    e2251f6 View commit details
    Browse the repository at this point in the history
  23. Thread safe caching of TStreamerInfo in TBranchSTL

    We now protect all threaded access to TClass::GetStreamerInfos. In addition
    this change properly handles updating the TStreamerInfo cache in a
    thread safe manner.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    bf04e1c View commit details
    Browse the repository at this point in the history
  24. Only set TStreamerInfo to unoptimized if it is optimized

    When running with multiple threads, we need to avoid unnecessary changes
    to TStreamerInfos. Therefore we check to see if the TStreamerInfo is optimized
    before setting it as unoptimized and rebuild it.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    a5752af View commit details
    Browse the repository at this point in the history
  25. Fix threading issues in TClass

    The following threading issues were corrected
    - TROOT::GetListOfClasses was protected via gCINTMutex
    - Access to TStreamerInfo lists were protected via gCINTMutex
    - Setting of the cache for current TStreamerInfo and for the list of
      conversion TStreamerInfos is protected via std::atomic<>
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    0f9bbe8 View commit details
    Browse the repository at this point in the history
  26. Made TPluginManager thread-safe for I/O

    Several changes were needed to make this thread-safe for the I/O case
    1) Protect the list of handlers with its own Mutex
    2) Use a thread_local variable to hold the status of reading a directory
    3) Use gCINTMutex to protect access to fBasesLoaded. Had to use gCINTMutex
     since we need threads trying to read the same dirs to wait for the first
     reader to finish so the lock has to be held over the whole call. In addition,
     gCINTMutex is sometimes taken before and sometimes during the call so using
     a different mutex would lead to a deadlock situation.
    NOTE: fReadingDirs is not used anymore but is still in the code to allow
    binary compatibility to easy testing. This should be removed in the future.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    bb39bbc View commit details
    Browse the repository at this point in the history
  27. Mutex lock removed from TStorage::ObjectDealloc to avoid deadlocks

    The order of locks between gGlobalMutex and gCINTMutex is undefined
    and TStorage::ObjectDealloc calls were involved in order reversal
    problems. As it turned out, there is no data structure that needs
    protecting in TStorage::ObjectDealloc so we do not need the lock.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    c417108 View commit details
    Browse the repository at this point in the history
  28. Use thread_local for statics in TUUID

    TUUID used statics that were causing race conditions. The fix
    was to change the statics to thread_local.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    c9698f7 View commit details
    Browse the repository at this point in the history
  29. Fix thread-safety issues with TError

    -There was a potential deadlock situation between gErrorMutex and
     gCINTMutex. The fix was to limit the scope of gErrorMutex locks
    -Changed buffers from static to static thread_local. This allowed
     gErrorMutex to be more limited in scope.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    ed8dba6 View commit details
    Browse the repository at this point in the history
  30. Use gCINTMutex to protect access to G__getgvp

    This fixed a problem found by helgrind.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    8bd0dcb View commit details
    Browse the repository at this point in the history
  31. Use gCINTMutex to protect access to TBaseClass::Property

    Helgrind found a race condition involving TClass::GetBaseClassOffsetRecurse
    calling TBaseClass::Property.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    ae1d5e8 View commit details
    Browse the repository at this point in the history
  32. Fix thread-safety problems with cleanup of containers

    Both TList and TObjArray modify gROOT::GetListOfCleanups() as
    part of their cleanup methods. This change uses gROOTMutex to
    protect that list.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    6f5e0a0 View commit details
    Browse the repository at this point in the history
  33. Fix thread-safety issues of StreamerInfos

    -Made TStreamerInfo::fgElement thread_local
    -Added an additional test bit to avoid rerunning TStreamerInfo::BuildOld.
     This avoids many cases of changing a TStreamerInfo once it is already in use.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    545c70e View commit details
    Browse the repository at this point in the history
  34. Made gTree thread_local

    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    ecbe8cc View commit details
    Browse the repository at this point in the history
  35. Properly avoid repeated calls to TStreamerInfo::Build*

    -Internal cloning of TStreamerInfo resets kBuildOldUsed so BuildOld will run
    -BuildOld calls itself recursively so we only set kBuildOldUsed once we
     leave the function
    -Avoid repeated calls to Build
    These changes are needed to avoid having multiple threads do the same
    work on the same TStreamerInfos which can cause interference between threads.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    551a92c View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    25d5ea5 View commit details
    Browse the repository at this point in the history
  37. Made TROOT ReadingObject methods thread safe

    Made use of a thread_local to hold the ReadingObject status since
    the status is only meant to apply to a call chain.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    8ff03b1 View commit details
    Browse the repository at this point in the history
  38. Made global counters in TFile atomic

    To properly handle cases where different TFiles are being used
    on different threads, the various global counters in TFile
    were converted to std::atomic<>.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    15d51d1 View commit details
    Browse the repository at this point in the history
  39. Used std::atomic to protect TStreamerInfo counters

    fLiveCount and fgCount are now atomic since they can be
    read/modified on different threads without a mutex.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    40ebff6 View commit details
    Browse the repository at this point in the history
  40. Use std::atomic to protect access to TClass state

    Changed fVersionUsed and fgClassCount of TClass to be std::atomic
    since both could be read/modified from different threads without
    a mutex.
    Also put back fgCallingNew as a class member to minimize code
    changes with non-thread safe version.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    fba383e View commit details
    Browse the repository at this point in the history
  41. Need to reset kBuildOldUsed bit when reading TStreamerInfo

    The kBuildOldUsed bit is transient, like kIsCompiled, and therefore
    must be reset when a TStreamerInfo is read from a file.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    6659ee5 View commit details
    Browse the repository at this point in the history
  42. Need to use CINT mutex in Cintex::Callback::operator()

    During the call the Cintex::Callback::operator(), several CINT
    data structures are modified and therefore we must take the lock.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    8e6ccdd View commit details
    Browse the repository at this point in the history
  43. Minimize the time spent holding the Cintex mutex lock

    To avoid lock order problems, we minimize the time spend holding
    the Cintex lock by ROOTClassEnhancer. In addition, there was
    a race condition in the previous code during the returning of the
    value. That race condition is now fixed.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    ea025ac View commit details
    Browse the repository at this point in the history
  44. Make last error string in TSystem a thread_local

    To handle errors occuring on different threads, the caching of the
    last error string was changed from being a member data to a class
    static thread_local. This meshes well with Unix since errno is a
    thread local there.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    865a401 View commit details
    Browse the repository at this point in the history
  45. Thread safety fixes for TUnixSystem

    TSystem changed the last error string to be a class thread_local
    so this code matches that change.
    Caching of external path is now a thread_local to avoid race conditions.
    Caching of initial time is done via an atomic.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    48a6405 View commit details
    Browse the repository at this point in the history
  46. Use Mutex to protect gObjectVersionRepository

    TClass.cxx has a file scope global gObjectVersionRepository which
    can be modified simultaneously on multiple threads. Therefore it
    needed a mutex lock when reading/writing.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    371da00 View commit details
    Browse the repository at this point in the history
  47. TStreamerElement cached strings changed to thread_local

    Full name and include name were statics which were set the first time
    called. This was not thread safe. These were changed to thread_local.
    Alternatively, this could be change to use std::call_once.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    7033522 View commit details
    Browse the repository at this point in the history
  48. Fix thread-safety issues with string formating

    The stand-alone formating functions return a pointer to a static
    buffer. That is not thread-safe since the buffer could be updated
    on a different thread while another thread is reading it. This
    change makes the static buffer variable thread_local.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    049ebd7 View commit details
    Browse the repository at this point in the history
  49. fgIsA needs to be thread safe

    Classes which inherit from TObject have a fgIsA class member
    defined by the code generator. However, the value for fgIsA is
    set lazily and therefor must be protected in a threaded environment.
    fgIsA was changed to be std::atomic<> and the setting of the value
    was protected by gCINTMutex to avoid having the calculation done
    more than once.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    dde43fd View commit details
    Browse the repository at this point in the history
  50. Fix caching bug in ROOTClassEnhancer::IsA

    When looking up the value of a cache in the map, it was possible
    to temporarily have fLastClass and fLastType out of synch and cause
    the program to return the wrong TClass.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    0266347 View commit details
    Browse the repository at this point in the history
  51. Avoid holding gCINTMutex and gROOTMutex simultaneously in TPluginManager

    By having a TObjArray be deleted outside of the gCINTMutex lock
    we no longer have both mutexes being held at the same time and therefore
    we avoid potential deadlocks.
    Dr15Jones authored and ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    44e5441 View commit details
    Browse the repository at this point in the history
  52. Merge pull request root-project#4 from ktf/fix-mt-io

    Fix multithreading issues in ROOT I/O
    ktf committed Feb 26, 2014
    Configuration menu
    Copy the full SHA
    7f9948f View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2014

  1. Worked around ambiguity in C++ for fgIsA and std::atomic<>

    The code created by genreflex was including the default namespace
    qualifyer '::' on all class names. However, this lead to a C++
    language ambiguity when parsing
       std::atomic<TClass*> ::Foo::fgIsA = 0
    where the parser treats that as being
       std::atomic<TClass*>::Foo::fgIsA = 0
    and fails since Foo is not a type defined in std::atomic<>.
    The fix was to remove the '::' when generating the code. This then
    matches what Cint does when generating the code.
    Dr15Jones committed Feb 27, 2014
    Configuration menu
    Copy the full SHA
    9524f6c View commit details
    Browse the repository at this point in the history
  2. Merge pull request root-project#5 from Dr15Jones/fixGenreflexProblemW…

    …ithfgIsA
    
    Worked around ambiguity in C++ for fgIsA and std::atomic<>
    ktf committed Feb 27, 2014
    Configuration menu
    Copy the full SHA
    705062d View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2014

  1. Revert "Fix trampolines for ARM."

    This reverts commit 1b092e4.
    ktf committed Feb 28, 2014
    Configuration menu
    Copy the full SHA
    b262c2c View commit details
    Browse the repository at this point in the history
  2. Merge pull request root-project#6 from ktf/remove-arm-fix

    Revert "Fix trampolines for ARM."
    ktf committed Feb 28, 2014
    Configuration menu
    Copy the full SHA
    1c5a843 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2014

  1. Make gCintMutex and gROOTMutex use the same mutex

    In order to avoid deadlocking, the variables gCintMutex and
    gROOTMutex now point to the same underlying mutex. The mutex is
    also created when TThread::Init() is first called rather than doing
    it lazily.
    Dr15Jones committed Mar 20, 2014
    Configuration menu
    Copy the full SHA
    814e69c View commit details
    Browse the repository at this point in the history