Jump to content

Semaphores/Mutexes


NoComment

Recommended Posts

Hi there!

 

I'm currently looking for a way to implement mutexes in PHP/MySQL.

 

I wasn't sure if it belongs into the PHP forum or rather into the MySQL forum. So I apologize if it's in the wrong forum.

 

Imagine PHP script #1 tries to access a MySQL database and reads data from a table. At the same time PHP script #2 is executed, which tries to delete the very data script #1 is currently trying to read. This is especially problematic if script #1 has to read from the database multiple times, process the read information, read from the database again, etc, while the 2nd script is deleting this data.

 

Is there a way to prevent that--so that PHP script #2 waits till PHP script #1 has done all its work and THEN deletes the table? Of course, the above mentioned situation is only an example, and I don't need a fix for THIS specific example, but I need to find a more generic way to implement mutexes/semaphores.

 

Does anybody have an idea on how to do that?

 

Thank you in advance! :)

Link to comment
https://forums.phpfreaks.com/topic/57473-semaphoresmutexes/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.