fork - chung-leong/qb GitHub Wiki

fork - Split execution of the current function across multiple CPU cores

uint32_t fork(uint32_t $count)

fork() splits the current function into multiple copies and tries to run them concurrently. All local variables are replicated. Each fork will receive a unique fork id, which you can use to identify which part of a given task the fork should work on.

Use spoon() to merge the copies again.

Parameters

count - The number of forks to create.

Return Value

The fork id. It'll number from 0 to count - 1.

Version

2.0 and above.