@@ -1421,13 +1421,14 @@ thread_local int profiling_rules_entered = 0;
1421
1421
int profiling_output_to_file = 0 ;
1422
1422
static SC_ATOMIC_DECLARE (uint64_t , samples ) ;
1423
1423
static uint64_t rate = 0 ;
1424
- int profiling_rules_active = 0 ;
1424
+ static SC_ATOMIC_DECLARE ( bool , profiling_rules_active ) ;
1425
1425
1426
1426
/**
1427
1427
* \brief Initialize profiling.
1428
1428
*/
1429
1429
void SCProfilingInit (void )
1430
1430
{
1431
+ SC_ATOMIC_INIT (profiling_rules_active );
1431
1432
SC_ATOMIC_INIT (samples );
1432
1433
intmax_t rate_v = 0 ;
1433
1434
@@ -1451,7 +1452,7 @@ void SCProfilingInit(void)
1451
1452
/* see if we want to profile rules for this packet */
1452
1453
int SCProfileRuleStart (Packet * p )
1453
1454
{
1454
- if (profiling_rules_active != 1 ) {
1455
+ if (! SC_ATOMIC_GET ( profiling_rules_active ) ) {
1455
1456
return 0 ;
1456
1457
}
1457
1458
uint64_t sample = SC_ATOMIC_ADD (samples , 1 );
@@ -1467,13 +1468,13 @@ int SCProfileRuleStart(Packet *p)
1467
1468
1468
1469
int SCProfileRuleStartCollection (void )
1469
1470
{
1470
- profiling_rules_active = 1 ;
1471
+ SC_ATOMIC_SET ( profiling_rules_active , true) ;
1471
1472
SCReturnInt (TM_ECODE_OK );
1472
1473
}
1473
1474
1474
1475
int SCProfileRuleStopCollection (void )
1475
1476
{
1476
- profiling_rules_active = 0 ;
1477
+ SC_ATOMIC_SET ( profiling_rules_active , false) ;
1477
1478
SCReturnInt (TM_ECODE_OK );
1478
1479
}
1479
1480
0 commit comments