Skip to content

Commit b921af6

Browse files
jingjingxykmatyhtf
andauthored
fix bug swoole-cpu-set-to-array (#5804)
* fix bug swoole-cpu-set-to-array * test * Added comments --------- Co-authored-by: Tianfeng.Han <[email protected]>
1 parent a6db047 commit b921af6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ext-src/php_swoole_private.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,16 @@ php_socket *php_swoole_convert_to_socket(int sock);
389389

390390
#ifdef HAVE_CPU_AFFINITY
391391
bool php_swoole_array_to_cpu_set(const zval *array, cpu_set_t *cpu_set);
392-
void php_swoole_cpu_set_to_array(zval *array, const cpu_set_t *cpu_set);
392+
/**
393+
* Converts a cpu_set_t structure to a PHP array.
394+
*
395+
* Note: On Cygwin platform, CPU_ISSET is a function that takes a non-const pointer as its second parameter,
396+
* which is why the cpu_set parameter cannot be declared as const.
397+
*
398+
* @param array The PHP array to store the CPU set information
399+
* @param cpu_set The CPU set structure to convert
400+
*/
401+
void php_swoole_cpu_set_to_array(zval *array, cpu_set_t *cpu_set);
393402
#endif
394403

395404
zend_bool php_swoole_signal_isset_handler(int signo);

ext-src/swoole_process.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ bool php_swoole_array_to_cpu_set(const zval *array, cpu_set_t *cpu_set) {
977977
return true;
978978
}
979979

980-
void php_swoole_cpu_set_to_array(zval *array, const cpu_set_t *cpu_set) {
980+
void php_swoole_cpu_set_to_array(zval *array, cpu_set_t *cpu_set) {
981981
array_init(array);
982982

983983
int cpu_n = SW_CPU_NUM;

0 commit comments

Comments
 (0)