Skip to content

Commit 89e4de8

Browse files
committed
ext/pcntl: Use bool type for some module globals
This clarifies intention and uses less bytes in the struct
1 parent 36358ba commit 89e4de8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ext/pcntl/pcntl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ static void pcntl_signal_handler(int signo)
13551355
PCNTL_G(head) = psig;
13561356
}
13571357
PCNTL_G(tail) = psig;
1358-
PCNTL_G(pending_signals) = 1;
1358+
PCNTL_G(pending_signals) = true;
13591359
if (PCNTL_G(async_signals)) {
13601360
zend_atomic_bool_store_ex(&EG(vm_interrupt), true);
13611361
}
@@ -1386,7 +1386,7 @@ void pcntl_signal_dispatch(void)
13861386
zend_fiber_switch_block();
13871387

13881388
/* Prevent reentrant handler calls */
1389-
PCNTL_G(processing_signal_queue) = 1;
1389+
PCNTL_G(processing_signal_queue) = true;
13901390

13911391
queue = PCNTL_G(head);
13921392
PCNTL_G(head) = NULL; /* simple stores are atomic */
@@ -1418,10 +1418,10 @@ void pcntl_signal_dispatch(void)
14181418
queue = next;
14191419
}
14201420

1421-
PCNTL_G(pending_signals) = 0;
1421+
PCNTL_G(pending_signals) = false;
14221422

14231423
/* Re-enable queue */
1424-
PCNTL_G(processing_signal_queue) = 0;
1424+
PCNTL_G(processing_signal_queue) = false;
14251425

14261426
/* Re-enable fiber switching */
14271427
zend_fiber_switch_unblock();

ext/pcntl/php_pcntl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ struct php_pcntl_pending_signal {
4343

4444
ZEND_BEGIN_MODULE_GLOBALS(pcntl)
4545
HashTable php_signal_table;
46-
int processing_signal_queue;
46+
bool processing_signal_queue;
4747
struct php_pcntl_pending_signal *head, *tail, *spares;
4848
int last_error;
49-
volatile char pending_signals;
49+
volatile bool pending_signals;
5050
bool async_signals;
5151
unsigned num_signals;
5252
ZEND_END_MODULE_GLOBALS(pcntl)

0 commit comments

Comments
 (0)