Ignore:
Timestamp:
Jul 19, 2018, 2:39:51 PM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.6.1
Children:
209f4c
Parents:
ca2880
git-author:
Frederik Heber <frederik.heber@…> (07/19/18 14:39:04)
git-committer:
Frederik Heber <frederik.heber@…> (07/19/18 14:39:51)
Message:

FIX: Constrained locking in CodePattern's Notification and Observable.

  • this is not a full soluton to possible race conditions with Qt's own threading but seems to help for the guichecks.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ThirdParty/CodePatterns/src/Observer/Notification.cpp

    rca2880 r9ac3d3  
    5252void Notification::notifyAll(Observable * const publisher)
    5353{
    54   boost::recursive_mutex::scoped_lock guard(TargetsLock);
    55   // copy such that signOff() within receiving update() does not affect iterating
    56   // this is because within the same thread and with the update() signOff() may be
    57   // called and when executed it modifies targets
    58   targets_t temp_targets = targets;
     54  targets_t temp_targets;
     55  {
     56    boost::recursive_mutex::scoped_lock guard(TargetsLock);
     57    // copy such that signOff() within receiving update() does not affect iterating
     58    // this is because within the same thread and with the update() signOff() may be
     59    // called and when executed it modifies targets
     60    temp_targets = targets;
     61  }
    5962  for(targets_t::iterator it=temp_targets.begin();
    6063      it!=temp_targets.end();++it){
Note: See TracChangeset for help on using the changeset viewer.