Branch: Tag:

2018-08-05

2018-08-05 09:21:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Thread.ResourceCount: Fixed mutex handling.

864: Inside #if constant(__builtin.thread_id)
   }       /*semi*/private void _destruct() { +  MutexKey key = parent->_mutex->lock();    --parent->_count; -  MutexKey lock = parent->_mutex->lock(); +     parent->_cond->signal();    }   }
895: Inside #if constant(__builtin.thread_id)
   //! @param level    //! The maximum level that is considered drained.    /*semi*/final void wait_till_drained(void|int level) { +  MutexKey key = _mutex->lock();    while (_count > level) // Recheck before allowing further -  _cond->wait(_mutex->lock()); +  _cond->wait(key);    }       //! Increments the resource-counter.    //! @returns    //! A @[ResourceCountKey] to decrement the resource-counter again.    /*semi*/final ResourceCountKey acquire() { -  +  MutexKey key = _mutex->lock();    _count++;    return ResourceCountKey(this);    }