Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.