mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Address #1140 comments
This commit is contained in:
parent
f5059cfaca
commit
b178939cfe
3 changed files with 9 additions and 9 deletions
|
|
@ -30,10 +30,10 @@ public:
|
|||
// function will return without actually modifying the data. It has been
|
||||
// found that returning the transport calculation and possibly re-adding the
|
||||
// element later is slightly faster than waiting on the lock to be released.
|
||||
void push(int new_elem)
|
||||
void push_back(int new_elem)
|
||||
{
|
||||
// Try to acquire the lock.
|
||||
std::unique_lock<ThreadMutex> lock(mutex_, std::try_to_lock);
|
||||
std::unique_lock<OpenMPMutex> lock(mutex_, std::try_to_lock);
|
||||
if (lock) {
|
||||
// It is possible another thread already added this element to the list
|
||||
// while this thread was searching for a cell so make sure the given
|
||||
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
private:
|
||||
std::forward_list<value_type> list_;
|
||||
ThreadMutex mutex_;
|
||||
OpenMPMutex mutex_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@ namespace openmc {
|
|||
//! This type meets the C++ "Lockable" requirements.
|
||||
//==============================================================================
|
||||
|
||||
class ThreadMutex
|
||||
class OpenMPMutex
|
||||
{
|
||||
public:
|
||||
ThreadMutex()
|
||||
OpenMPMutex()
|
||||
{
|
||||
#ifdef _OPEMP
|
||||
omp_init_lock(&mutex_);
|
||||
#endif
|
||||
}
|
||||
|
||||
~ThreadMutex()
|
||||
~OpenMPMutex()
|
||||
{
|
||||
#ifdef _OPEMP
|
||||
omp_destroy_lock(&mutex_);
|
||||
|
|
@ -33,8 +33,8 @@ public:
|
|||
// Mutexes cannot be copied. We need to explicitly delete the copy
|
||||
// constructor and copy assignment operator to ensure the compiler doesn't
|
||||
// "help" us by implicitly trying to copy the underlying mutexes.
|
||||
ThreadMutex(const ThreadMutex&) = delete;
|
||||
ThreadMutex& operator= (const ThreadMutex&) = delete;
|
||||
OpenMPMutex(const OpenMPMutex&) = delete;
|
||||
OpenMPMutex& operator= (const OpenMPMutex&) = delete;
|
||||
|
||||
//! Lock the mutex.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ find_cell(Particle* p, bool use_neighbor_lists)
|
|||
// cells in this universe, and update the neighbor list if we find a new
|
||||
// neighboring cell.
|
||||
found = find_cell_inner(p, nullptr);
|
||||
if (found) c.neighbors_.push(p->coord[coord_lvl].cell);
|
||||
if (found) c.neighbors_.push_back(p->coord[coord_lvl].cell);
|
||||
return found;
|
||||
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue