EgtGeomKernel 2.7l1 :

- piccola ottimizzazione in LockAddErase.
This commit is contained in:
Dario Sassi
2025-12-04 19:10:07 +01:00
parent c8e2d88bb7
commit 17fe5f0c9c
2 changed files with 4 additions and 3 deletions
+4 -3
View File
@@ -38,16 +38,17 @@ using namespace std ;
class LockAddErase
{
public :
LockAddErase( atomic_flag& bAddEraseOn, bool bUse = true): m_bAddEraseOn( bAddEraseOn), m_bUse( bUse)
LockAddErase( atomic_flag& bAddEraseOn, bool bUse = true)
: m_bAddEraseOn( bAddEraseOn), m_bUse( bUse)
{ if ( ! m_bUse) return ;
while ( m_bAddEraseOn.test_and_set()) {
while ( m_bAddEraseOn.test_and_set( memory_order_acquire)) {
this_thread::sleep_for( chrono::nanoseconds{ 1}) ;
}
} ;
~LockAddErase( void)
{ if ( ! m_bUse) return ;
m_bAddEraseOn.clear() ;
m_bAddEraseOn.clear( memory_order_release) ;
} ;
private :