Makes sense now why someone paided me to make a custom shared memory
extension for php.
Wish now I had kepted the code ;)
Right now im "cheating"
The control process listens to msg_receive, and "broadcasts" to all
using shm
It works for passing around simple messages but for passing around
information like a list of whos in what rooms it doesn't work so great.
Richard Thomas - CEO
Cyberlot Technologies Group Inc.
507.398.4124 - Voice
Bob Glamm wrote:
Semaphores aren't particularly slow unless you have thousands of
threads.
The problem with sem_acquire() in PHP is that it is missing the
sem_op parameter normally found in semop() - sem_op for sem_acquire()
in PHP is always set to one, which means that it is only useful for
a) limiting access to a critical resource read-only to a specific
number of clients; or
b) full locking of the critical resource to one client at a time,
read or write.
You can't have both.
For a normal semop() call you can adjust the sem_op parameter so that
you can have multiple readers / one writer of the critical resource
in question - the writer will block out the rest of the readers while
it's writing, but the writer can also be made to wait until after all
the readers are done (PHP can't do the latter).
I don't know if whoever wrote the sem_* PHP bindings didn't
understand the semop(2) man page or if it's a limitation of Win32
semaphores or whatever, but the sem_* functions aren't terribly
useful in their current state.
-Bob
On Jun 29, 2005, at 3:24 PM, Richard Thomas wrote:
Anyone on the lists play with pcntl_fork much?
Getting back to my php/flash based chat room and I am playing with
making a forked version for performance but having issues figuring
out how to smoothly communicate information between all the threads.
Right now I have a msg/shm hybred that works for a simple chat room
but doesn't consider constantly changing information that needs to
be open to all. Constantly getting and releasing semaphores seems
time consuming??
--
Richard Thomas - CEO
Cyberlot Technologies Group Inc.
507.398.4124 - Voice
---------------------------------------------------------------------
To unsubscribe, e-mail: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
Please read and follow the list guidelines:
http://www.tcphp.org/mailing_list/guidelines
The tcphp.org mailing list is sponsored by pajunas interactive, inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
Please read and follow the list guidelines:
http://www.tcphp.org/mailing_list/guidelines
The tcphp.org mailing list is sponsored by pajunas interactive, inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx
Please read and follow the list guidelines:
http://www.tcphp.org/mailing_list/guidelines
The tcphp.org mailing list is sponsored by pajunas interactive, inc.