Running a code block with timeout

From: Date: Wed, 30 Oct 2019 12:02:29 +0000
Subject: Running a code block with timeout
Groups: php.general 
Request: Send a blank email to php-general+get-326930@lists.php.net to get a copy of this message
Hi everyone, We're looking for a way to run a code block with a timeout. Our use case involves evaluating an expression written in a custom DSL (similar to Symfony Expression Language), and we want to ensure that the execution will not exceed a given time limit. We tried a naive approach using set_time_limit, but there is no way to catch the exception from the block code that timed out. We then considered using PCNTL, but its use is discouraged production environments. Do you guys have any suggestions? - Marcos

« previous php.general (#326930) next »