Skip to content

Commit 376bdd9

Browse files
committed
changes from feedback
1 parent ca3b54b commit 376bdd9

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

ext/pcntl/pcntl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ PHP_FUNCTION(pcntl_getqos_class)
16371637
{
16381638
// unlikely unless an external tool set the QOS class with a wrong value
16391639
PCNTL_G(last_error) = errno;
1640-
zend_value_error("invalid QOS class %u", qos_class);
1640+
zend_throw_error(NULL, "invalid QOS class %u", qos_class);
16411641
RETURN_THROWS();
16421642
}
16431643

@@ -1655,11 +1655,9 @@ PHP_FUNCTION(pcntl_setqos_class)
16551655
if (pthread_set_qos_class_self_np((qos_class_t)qos_class, 0) != 0)
16561656
{
16571657
PCNTL_G(last_error) = errno;
1658-
zend_argument_value_error(1, "must be between QOS_CLASS_USER_INTERACTIVE and QOS_CLASS_BLACKGROUND");
1658+
zend_argument_value_error(1, "must be one of QOS_CLASS_USER_INTERACTIVE, QOS_CLASS_USER_INITIATED, QOS_CLASS_DEFAULT, QOS_CLASS_UTILITY and QOS_CLASS_BACKGROUND");
16591659
RETURN_THROWS();
16601660
}
1661-
1662-
RETURN_TRUE;
16631661
}
16641662
#endif
16651663

ext/pcntl/pcntl.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,5 +1039,5 @@ function pcntl_getcpu(): int {}
10391039

10401040
#ifdef HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP
10411041
function pcntl_getqos_class(): int {}
1042-
function pcntl_setqos_class(int $qos_class = QOS_CLASS_DEFAULT): bool {}
1042+
function pcntl_setqos_class(int $qos_class = QOS_CLASS_DEFAULT): void {}
10431043
#endif

ext/pcntl/pcntl_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/pcntl/tests/pcntl_qosclass.phpt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@ if (getenv('SKIP_REPEAT')) die("skip Not repeatable");
99
?>
1010
--FILE--
1111
<?php
12-
var_dump(pcntl_setqos_class(QOS_CLASS_DEFAULT));
12+
pcntl_setqos_class(QOS_CLASS_DEFAULT);
1313
var_dump(QOS_CLASS_DEFAULT === pcntl_getqos_class());
1414

1515
try {
1616
pcntl_setqos_class(QOS_CLASS_UNSPECIFIED);
1717
} catch (\ValueError $e) {
1818
echo $e->getMessage() . PHP_EOL;
1919
}
20-
var_dump(pcntl_setqos_class(QOS_CLASS_BACKGROUND));
20+
pcntl_setqos_class(QOS_CLASS_BACKGROUND);
2121
var_dump(QOS_CLASS_BACKGROUND === pcntl_getqos_class());
2222
?>
2323
--EXPECT--
2424
bool(true)
25-
bool(true)
26-
pcntl_setqos_class(): Argument #1 ($qos_class) must be between QOS_CLASS_USER_INTERACTIVE and QOS_CLASS_BLACKGROUND
27-
bool(true)
25+
pcntl_setqos_class(): Argument #1 ($qos_class) must be one of QOS_CLASS_USER_INTERACTIVE, QOS_CLASS_USER_INITIATED, QOS_CLASS_DEFAULT, QOS_CLASS_UTILITY and QOS_CLASS_BACKGROUND
2826
bool(true)

0 commit comments

Comments
 (0)