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?
You could base what you need on this:
for ($i; $i < 10; $i++) {
do_something();
sleep(1); // sleep for a second.
}
There is a POSIX compatible ptreads package, which may be useful here. See https://github.com/krakjoe/pthreads
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.