Reputation: 1161
I have to process a script that consumes a lot of CPU and this is for a bunch of users and depends on the user, so I want to run it once, wait for few seconds, run the next user, etc.
I tried delay but the issue I got is that I never get anything printed in the screen to get info about how the whole process is doing and to get intermediate results.
I have one script in which I plan to do this and then run the other process.
Any hints?
Upvotes: 0
Views: 662
Reputation: 524
There is a POSIX compatible ptreads package, which may be useful here. See https://github.com/krakjoe/pthreads
Upvotes: 0
Reputation: 3844
You could base what you need on this:
for ($i; $i < 10; $i++) {
do_something();
sleep(1); // sleep for a second.
}
Upvotes: 1