Skip to content

Commit

Permalink
Merge pull request #318 from YosysHQ/povik/fix-atomic_store-call
Browse files Browse the repository at this point in the history
Fix types in call to atomic_store_explicit
  • Loading branch information
alanminko authored Aug 8, 2024
2 parents dce6e48 + 2d26778 commit 762a123
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/misc/util/utilPth.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
using namespace std;
#else
#include <stdatomic.h>
#include <stdbool.h>
#endif

#endif
Expand Down Expand Up @@ -103,7 +104,7 @@ void * Util_Thread( void * pArg )
return NULL;
}
pThData->pUserFunc( pThData->pUserData );
atomic_store_explicit(&pThData->fWorking, 0, memory_order_release);
atomic_store_explicit(&pThData->fWorking, false, memory_order_release);
}
assert( 0 );
return NULL;
Expand Down Expand Up @@ -133,7 +134,7 @@ void Util_ProcessThreads( int (*pUserFunc)(void *), void * vData, int nProcs, in
ThData[i].pUserFunc = pUserFunc;
ThData[i].iThread = i;
ThData[i].nTimeOut = TimeOut;
atomic_store_explicit(&ThData[i].fWorking, 0, memory_order_release);
atomic_store_explicit(&ThData[i].fWorking, false, memory_order_release);
status = pthread_create( WorkerThread + i, NULL, Util_Thread, (void *)(ThData + i) ); assert( status == 0 );
}

Expand All @@ -150,7 +151,7 @@ void Util_ProcessThreads( int (*pUserFunc)(void *), void * vData, int nProcs, in
if ( atomic_load_explicit(&ThData[i].fWorking, memory_order_acquire) )
continue;
ThData[i].pUserData = Vec_PtrPop( vStack );
atomic_store_explicit(&ThData[i].fWorking, 1, memory_order_release);
atomic_store_explicit(&ThData[i].fWorking, true, memory_order_release);
break;
}
}
Expand All @@ -168,7 +169,7 @@ void Util_ProcessThreads( int (*pUserFunc)(void *), void * vData, int nProcs, in
for ( i = 0; i < nProcs; i++ )
{
ThData[i].pUserData = NULL;
atomic_store_explicit(&ThData[i].fWorking, 1, memory_order_release);
atomic_store_explicit(&ThData[i].fWorking, true, memory_order_release);
}

// Join threads
Expand Down
9 changes: 5 additions & 4 deletions src/proof/ssw/sswPart.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
using namespace std;
#else
#include <stdatomic.h>
#include <stdbool.h>
#endif

#endif
Expand Down Expand Up @@ -126,7 +127,7 @@ void * Ssw_GiaWorkerThread( void * pArg )
return NULL;
}
Cec_ManLSCorrespondenceClasses( pThData->p, &pThData->CorPars );
atomic_store_explicit(&pThData->fWorking, 0, memory_order_release);
atomic_store_explicit(&pThData->fWorking, false, memory_order_release);
}
assert( 0 );
return NULL;
Expand Down Expand Up @@ -154,7 +155,7 @@ void Ssw_SignalCorrespondenceArray( Vec_Ptr_t * vGias, Ssw_Pars_t * pPars )
{
ThData[i].CorPars = *pCorPars;
ThData[i].iThread = i;
atomic_store_explicit(&ThData[i].fWorking, 0, memory_order_release);
atomic_store_explicit(&ThData[i].fWorking, false, memory_order_release);
status = pthread_create( WorkerThread + i, NULL, Ssw_GiaWorkerThread, (void *)(ThData + i) ); assert( status == 0 );
}

Expand All @@ -171,7 +172,7 @@ void Ssw_SignalCorrespondenceArray( Vec_Ptr_t * vGias, Ssw_Pars_t * pPars )
if ( atomic_load_explicit(&ThData[i].fWorking, memory_order_acquire) )
continue;
ThData[i].p = (Gia_Man_t*)Vec_PtrPop( vStack );
atomic_store_explicit(&ThData[i].fWorking, 1, memory_order_release);
atomic_store_explicit(&ThData[i].fWorking, true, memory_order_release);
break;
}
}
Expand All @@ -188,7 +189,7 @@ void Ssw_SignalCorrespondenceArray( Vec_Ptr_t * vGias, Ssw_Pars_t * pPars )
for ( i = 0; i < nProcs; i++ )
{
ThData[i].p = NULL;
atomic_store_explicit(&ThData[i].fWorking, 1, memory_order_release);
atomic_store_explicit(&ThData[i].fWorking, true, memory_order_release);
}

// Join threads
Expand Down

0 comments on commit 762a123

Please sign in to comment.