#!/usr/bin/env php getKey(), $parcel->getKey()); // Send semaphore and parcel key to child process as command argument. $context = contextFactory()->start([ __DIR__ . "/contexts/parcel.php", (string) $semaphore->getKey(), (string) $parcel->getKey(), ]); delay(0.5); // Give the process or thread time to start and access the parcel. $parcel->synchronized(function (int $value): int { return $value + 1; }); $context->join(); // Wait for child process or thread to finish. printf("Final value of parcel: %d\n", $parcel->unwrap());