atomic workaround

This commit is contained in:
Joachim Schöberl 2017-08-17 20:20:30 +02:00
parent 5f211234d1
commit 4fe9abcc0e

View File

@ -350,10 +350,18 @@ namespace netgen
*/ */
// add lock-free to list // add lock-free to list
/*
surfelements[sei].next = facedecoding[el.index-1].firstelement; surfelements[sei].next = facedecoding[el.index-1].firstelement;
auto & head = reinterpret_cast<atomic<SurfaceElementIndex>&> (facedecoding[el.index-1].firstelement); auto & head = reinterpret_cast<atomic<SurfaceElementIndex>&> (facedecoding[el.index-1].firstelement);
while (!head.compare_exchange_weak (surfelements[sei].next, sei)) while (!head.compare_exchange_weak (surfelements[sei].next, sei))
; ;
*/
surfelements[sei].next = facedecoding[el.index-1].firstelement;
auto & head = reinterpret_cast<atomic<int>&> (facedecoding[el.index-1].firstelement);
auto & next = reinterpret_cast<int&> (surfelements[sei].next);
while (!head.compare_exchange_weak (next, sei))
;
/* /*
if (SurfaceArea().Valid()) if (SurfaceArea().Valid())