Critical Sections?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
raygr
Forum Newbie
Posts: 5
Joined: Mon Jun 30, 2003 3:16 pm

Critical Sections?

Post by raygr »

I have some files that I need to update atomically without interruptions. Is there some way to have critical sections in PHP, to avoid another script thread from running?

Thanks,
-Ray
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

nope, each script running should be seen as one process on its own, so only semaphores would help.
Though there is support for semaphores if it's only about file access take a look at php.net/flock
raygr
Forum Newbie
Posts: 5
Joined: Mon Jun 30, 2003 3:16 pm

Post by raygr »

Thanks volka. I should have thought of semaphores. That will probably do the trick.
Post Reply