Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please how can shared memory be created in PHP using shmop_* (not shm_* if that matters) be locked and unlocked? Does this require libraries?

It seems shmop_read() runs while shmop_write() is still writing because the value read has part of old and new values.

This is the situation, there are three sections. Section One open/create the shared memory segment and write/update it content. Section Two update what is already written into the segment while the Section Three read what is in the segment. Any of these sections can run at any time.
Updated 29-Apr-13 22:28pm
Mohibur Rashid 30-Apr-13 5:06am    
Why do you want to do that?
Oso Oluwafemi Ebenezer 30-Apr-13 5:22am    
Because am using the shared memory to monitor some user interactions and while reading content out of the segment, any user may perform any action that necessitate writing to the segment which will result in the situation I describe above.
Mohibur Rashid 30-Apr-13 5:57am    
I would suggest you think other way, may be database
Oso Oluwafemi Ebenezer 30-Apr-13 6:07am    
Database is out of the question because of heavy connection which database can't handle. Say 30k users at the same time!
Prasad Khandekar 30-Apr-13 6:44am    
Why not use an in memory database?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900