Sets the priority of a process.
This allows for controlling the order of processes rather than using FIFO.
Priority uses an ascending order where 0 > 1.
Processes registered with a high priority will be executed before those with a low or default priority.
Process priority is handy when multiple process will execute and their order is important.
Note
This is different from an interrupt.
Installed interrupts will still be executed before or after a prioritized process.
| Parameters: |
|
|---|---|
| Return type: | object Process |
This installs multiple process each with a seperate ascending priority.
<?php
xp_signal(XP_SIG('foo'), priority(0, function(){
echo 'foo';
}));
xp_signal(XP_SIG('foo'), priority(3, function(){
echo 'bar';
}));
xp_signal(XP_SIG('foo'), priority(5, function(){
echo 'hello';
}));
xp_signal(XP_SIG('foo'), priority(10, function(){
echo 'world';
}));
The above code will output.
foobarhelloworld