1.0.0
IPC has been greatly improved in this release. STDIN
and STDOUT
were previously used for process communication, redirecting child process output to STDERR
. However, this was often problematic for debugging and caused to confusion. Processes now used a dedicated socket for IPC, leaving the standard I/O streams available for for the user. These streams can be accessed on Context\Process
using getStdin()
, getStdout()
, and getStderr()
. No automatic forwarding of child output is done for Context\Process
. Worker\WorkerProcess
now automatically forwards STDOUT
and STDERR
to the parent STDOUT
and STDERR
. Using echo
, print
, printf()
, etc. in Worker\Task::run()
is still not recommended as ordering is not guaranteed and interleaving is very possible. However, for debugging purposes these functions can be useful.
Users of this library that only used the Worker\Worker
or Worker\Pool
interfaces are unlikely to need to make any changes to their code to upgrade from 0.2.x
. Most other BC breaks are minor.
STDOUT
of the process run usingContext\Process
is no longer redirected toSTDERR
of the parent process.STDIN
,STDOUT
, andSTDERR
of the child process are now available as stream objects usinggetStdin()
,getStdout()
, andgetStderr()
.AbstractWorker
has been renamed toTaskWorker
. The protected methodcancel()
was removed.- Subsequent calls to
Worker::shutdown()
now return the same promise as the first call. Prior, subsequent calls would throw an exception. Context\Context::start()
now returns a promise that is resolved once the context starts (or fails to start).Context\Process::run()
now returns a promise resolving to the instance ofContext\Process
created.Context\Thread::run()
now returns a promise resolving to the instance ofContext\Thread
created.Context\Thread::supported()
has been renamed toContext\Thread::isSupported()
.- Most classes in this library are now marked as final. (Composition over inheritance!)
- Error messages when tasks return unserializable data have been improved.
- Custom exception constructors skipping the code argument have been dropped in favor of using the standard constructor.
Worker\Environment::exists()
now declaresbool
as a return type (implementations should have always returned abool
, but is now declared in the interface).Worker\Pool::get()
has been renamed toWorker\Pool::getWorker()
.- The function
Worker\get()
has been renamed toWorker\worker()
.