mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
Use std::atomic in nl_lists.h with OpenMP
This commit is contained in:
parent
95f8658286
commit
f83078d8bf
2
.gitignore
vendored
2
.gitignore
vendored
@ -31,7 +31,7 @@
|
||||
!/makefile
|
||||
!/mame.doxygen
|
||||
!/*.md
|
||||
!/*.bdc
|
||||
!/*.bdf
|
||||
!/LICENSE
|
||||
/.idea
|
||||
regtests/chdman/temp
|
||||
|
@ -13,6 +13,9 @@
|
||||
#include "nl_config.h"
|
||||
#include "plib/plists.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// timed queue
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -62,7 +65,7 @@ namespace netlist
|
||||
{
|
||||
#if HAS_OPENMP && USE_OPENMP
|
||||
/* Lock */
|
||||
while (atomic_exchange32(&m_lock, 1)) { }
|
||||
while (m_lock.exchange(1)) { }
|
||||
#endif
|
||||
const _Time &t = e.exec_time();
|
||||
entry_t * i = m_end++;
|
||||
@ -94,7 +97,7 @@ namespace netlist
|
||||
{
|
||||
/* Lock */
|
||||
#if HAS_OPENMP && USE_OPENMP
|
||||
while (atomic_exchange32(&m_lock, 1)) { }
|
||||
while (m_lock.exchange(1)) { }
|
||||
#endif
|
||||
for (entry_t * i = m_end - 1; i > &m_list[0]; i--)
|
||||
{
|
||||
@ -143,7 +146,7 @@ namespace netlist
|
||||
private:
|
||||
|
||||
#if HAS_OPENMP && USE_OPENMP
|
||||
volatile INT32 m_lock;
|
||||
volatile std::atomic<int> m_lock;
|
||||
#endif
|
||||
entry_t * m_end;
|
||||
parray_t<entry_t> m_list;
|
||||
|
Loading…
Reference in New Issue
Block a user