Connecting Tech Pros Worldwide Help | Site Map

Synchronization in PHP ??

  #1  
Old March 17th, 2008, 04:55 AM
Hermann
Guest
 
Posts: n/a
Does exist any form of synchronization in PHP??
Namely locks, mutexes, semaphores, monitors, etc...

Thanks in advance.
Regards.
  #2  
Old March 17th, 2008, 06:25 AM
petersprc
Guest
 
Posts: n/a

re: Synchronization in PHP ??


PHP has an interface to SysV semaphores:

http://www.php.net/manual/en/function.sem-acquire.php

flock is also available for file-based inter-process synchronization.

On Mar 16, 11:52 pm, Hermann <Hermann.Rich...@gmail.comwrote:
Quote:
Does exist any form of synchronization in PHP??
Namely locks, mutexes, semaphores, monitors, etc...
>
Thanks in advance.
Regards.
  #3  
Old March 17th, 2008, 12:15 PM
Jerry Stuckle
Guest
 
Posts: n/a

re: Synchronization in PHP ??


Hermann wrote:
Quote:
Does exist any form of synchronization in PHP??
Namely locks, mutexes, semaphores, monitors, etc...
>
Thanks in advance.
Regards.
>
What kind of synchronization are you trying to do?

In general, PHP scripts don't talk to each other like they can in other
languages. There is a limited interface, but it's system dependent. So
there are some things you *can* do in PHP, but PHP may not necessarily
be the *best* language to do them in.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  #4  
Old March 17th, 2008, 12:55 PM
The Natural Philosopher
Guest
 
Posts: n/a

re: Synchronization in PHP ??


petersprc wrote:
Quote:
PHP has an interface to SysV semaphores:
>
http://www.php.net/manual/en/function.sem-acquire.php
>
flock is also available for file-based inter-process synchronization.
>
On Mar 16, 11:52 pm, Hermann <Hermann.Rich...@gmail.comwrote:
Quote:
>Does exist any form of synchronization in PHP??
>Namely locks, mutexes, semaphores, monitors, etc...
>>
>Thanks in advance.
>Regards.
>
and if interfacing to Mysql, there are lock facilities in that.

  #5  
Old March 17th, 2008, 12:55 PM
The Natural Philosopher
Guest
 
Posts: n/a

re: Synchronization in PHP ??


Jerry Stuckle wrote:
Quote:
Hermann wrote:
Quote:
>Does exist any form of synchronization in PHP??
>Namely locks, mutexes, semaphores, monitors, etc...
>>
>Thanks in advance.
>Regards.
>>
>
What kind of synchronization are you trying to do?
>
In general, PHP scripts don't talk to each other like they can in other
languages. There is a limited interface, but it's system dependent. So
there are some things you *can* do in PHP, but PHP may not necessarily
be the *best* language to do them in.
>
Quite.

If you have some heavy realtime interactive-across-many-web-interfaces
type problem, the better answer is to use php to do the user interface
parts, and have some core daemon written in 'C" or suchlike handling all
the interactivity bits.

And write a PHP extesnion to access it.


  #6  
Old March 17th, 2008, 06:45 PM
Hermann
Guest
 
Posts: n/a

re: Synchronization in PHP ??


Alright guys. Perfectly clear. Thank you all by your replies.

I just need to do an atomic test-and-set in a MyISAM table (a global
shared variable for the whole website).
But I think it would be better if I use a shared variable. Those that
are provided by php caching packages.
Actually, I read that eAccelerator has a lock function in its API, so
that would be perfect.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does Synchronization work properly in file handling in php? tushar deshpande answers 4 July 27th, 2007 10:05 PM
Mantain a variable through several scripts like global.asa variables in asp Zeppelin answers 12 December 29th, 2005 12:15 PM
Synchronization between 2 PHP threads? Eric B. answers 8 July 17th, 2005 01:17 PM
PHP and Threading - is it possible? comp.lang.php answers 14 July 17th, 2005 12:26 PM