Alarm inside php

hi when implementing a connection that remains open for a long time (comet), how can I implement signaling between php profiles (outstanding requests)?

Example Timeline:

  • request 1 start
  • request 1 does an action
  • request 1 dream
  • request 2 starts
  • request 2 does the action
  • request 2 notifies request 1 and goes to bed
  • request 1 wakes up and sends new data
  • request 1 sleeps agen

I wandered if it was a method using less (noting?) That cpu prosessing

+5
source share
3 answers

If your platform is Linux / Unix, you can use queues .

  • request 1 start
  • request 1 does an action
  • 1 (sleep (1) )
  • 2
  • 2
  • 2
  • 1 ,
  • 1

sleep(), .

+3

, pcntl_signal(), pcntl_fork(). forking, .

cpu, usleep() , .

+1

"" .

script 1 - ""
script 1 , , , ,
else sleep/repeat

script 2 checks for incomplete jobs in the database;
if so, then act and write returncode
else sleep / repeat

0
source

All Articles