session_write_close and session_readonly

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
mauricebis
Forum Newbie
Posts: 1
Joined: Mon Sep 17, 2007 11:32 am

session_write_close and session_readonly

Post by mauricebis »

Hi!

The php documentation is a bit poor about session_write_close and session_readonly and I could do with a bit of "expert help":

Q1) Is session_write_close SYNCHRONOUS that is when we execute the instruction that follows the call, we know that the session variables have been written and the lock (acquired on session_start) has been released or is it ASYNCHRONOUS, as I guess it is, in which case there is apparently no way to know when the writing is done?

Q2) Does session_readonly bypass the lock protocol or does it acquire a read lock permitting several session_readonly to proceed in parallel? If session_write_close is asynchronous and session_readonly bypass locking, it appears difficult to use session_readonly in a read-script after a write-script making use of session_write_close has been called without getting exposed to a race condition whereby we attempt to read the session variables before they are written?

Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Question one can be tested by yourself as can question two. Have you tested these?
Post Reply