Re: [APC-DEV] atomaticity/thread safeness of apc shared memory functions + mutexes
[email protected] (Rasmus Lerdorf) Wed, 24 Dec 2008 18:26:50 -0500
| Newsgroups | php.apc.dev |
|---|---|
| Message-ID | <[email protected]> |
Exception e wrote: > Couldn't find it in the docs, so I hope you know it: > > Are the userland apc cache functions (apc_add, apc_fetch, apc_delete > etc) *thread-safe/atomic*? > > > Also: I need to ensure that conncurrent access to shared memory doesn't > get me in race conditions. Wouldn't it be nice if apc could offer mutex > functions and the like? There is a semaphore extension for php, but it > is *nix-only according to the docs. The need for synchronization > mechanisms arise almost allways when using shared memory. Yes, they are atomic and they are locked appropriately. You don't need any sort of mutex. This is shared memory. Generally we don't suggest running PHP in any sort of threaded environment though. -Rasmus