session locking?

From: Date: Thu, 02 Dec 1999 13:42:55 +0000
Subject: session locking?
Groups: php.version4 
Request: Send a blank email to php-version4+get-7241@lists.php.net to get a copy of this message
Is there any way to sync session usage between different script instances ? What i am trying to do is to display a mail i fetched from a pop3 server. Lets imagine a mail containing HTML text with two inlined images. script 1 fetches the entire message from the pop3 server and extracts the different mime parts. theese are stored in session variables the IMG references in the HTML code get patched so that they now refer to script 2 and 3 which will generate the images from the data stored in the session but when the output of script 1 is transfered to the browser, the browser will send a request for the images as soon as the image tag is closed so script 2 might get started even before script 1 has actually finished and written back its session data ( see timeline below ) ---->t script 1 HTML |-------------[IMG1]--[IMG2]-|............................... script 2 IMG1 ......................|---------------|...................... script 3 IMG2 ...............................|-------------|............... so as a result the browser displays the message and IMG2, but IMG1 is broken whith only one image it would be even worse because script 2 would not even read obsolete session data, but also overwrite the actual session that script 1 wrote back after script 2 started ... currently i sleep() for some seconds before calling session_start() in script 2 & 3, but this can't be the solution in the long run so what i need is some mechanism to lock a session against concurrent access by making session_start() wait for previous script to write back their data or at least a session_end() function that forces a session-data writeback from within script 1 as soon as it has modified all session data and _before_ it generates the HTML containing the image tags

« previous php.version4 (#7241) next »