note 99334 deleted from function.pcntl-fork by danbrown

From: Date: Wed, 11 Aug 2010 15:43:41 +0000
Subject: note 99334 deleted from function.pcntl-fork by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171573@lists.php.net to get a copy of this message
Note Submitter: me ---- in reply to julian below: a) this is not really related to fork() b) a much more elegant method is to avoid the race condition on the server-side, with an atomic check and update operation: update queue set worker_id=$id,status='processing' where worker_id is null and status='free' select * from queue where worker_id=$id -- we now either have our job to process, or got none and sleep/try again you might also do away with the status column if you delete jobs that are done, or use affected_rows() to check if you grabbed a job successfully

« previous php.notes (#171573) next »