modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-09-26 17:35:03 +04:00
parent 333ddca4f5
commit 789642ce5f
2 changed files with 6 additions and 4 deletions

View File

@ -11,7 +11,6 @@ class SteamTrainApp extends Application {
const USE_LOGFILE = true; const USE_LOGFILE = true;
const USE_RUNFILE = true; const USE_RUNFILE = true;
const USE_RUNLOCK = true; const USE_RUNLOCK = true;
const USE_SIGNAL_HANDLER = true;
const ARGS = [ const ARGS = [
"purpose" => self::TITLE, "purpose" => self::TITLE,
@ -22,14 +21,17 @@ EOT,
["-c", "--count", "args" => 1, ["-c", "--count", "args" => 1,
"help" => "spécifier le nombre d'étapes", "help" => "spécifier le nombre d'étapes",
], ],
["-s", "--use-signal-handler", "value" => true, ["-s", "--install-signal-handler", "value" => true,
"help" => "installer un gestionnaire de signaux", "help" => "installer un gestionnaire de signaux",
], ],
]; ];
protected $count = 100; protected $count = 100;
protected bool $installSignalHandler = false;
function main() { function main() {
if ($this->installSignalHandler) app2::install_signal_handler();
$count = intval($this->count); $count = intval($this->count);
app2::action("Running train...", $count); app2::action("Running train...", $count);
for ($i = 1; $i <= $count; $i++) { for ($i = 1; $i <= $count; $i++) {

View File

@ -80,7 +80,7 @@ abstract class Application {
const USE_RUNLOCK = false; const USE_RUNLOCK = false;
/** @var bool faut-il installer le gestionnaire de signaux? */ /** @var bool faut-il installer le gestionnaire de signaux? */
const USE_SIGNAL_HANDLER = false; const INSTALL_SIGNAL_HANDLER = false;
static function _manage_runfile(int $argc, array $argv, RunFile $runfile): void { static function _manage_runfile(int $argc, array $argv, RunFile $runfile): void {
if ($argc <= 1 || $argv[1] !== "//") return; if ($argc <= 1 || $argv[1] !== "//") return;
@ -125,7 +125,7 @@ abstract class Application {
} }
}; };
register_shutdown_function($shutdown); register_shutdown_function($shutdown);
app2::install_signal_handler(static::USE_SIGNAL_HANDLER); app2::install_signal_handler(static::INSTALL_SIGNAL_HANDLER);
try { try {
static::_initialize_app(); static::_initialize_app();
$useRunfile = static::USE_RUNFILE; $useRunfile = static::USE_RUNFILE;