Nick
nick at dd.revealed.net
Wed Jun 15 22:30:21 EDT 2005
Duh, I'm showing my age... you want fcntl, not flock. Nick Nick wrote: > Dan Eloff wrote: > >> But here's the problem. Some resources (files, dbms) are shared >> between processes and threads, so how can you synchronize access to >> them? >> >> In the Session module which has a session implementation using a dbm, >> _apache._global_lock and _apache._global_unlock is used. > > > I tend to stay away from using apache's locks, since they are limited in > number and are used by apache and its modules. I find flock works well > in these cases, as it is the usual way to deal with simultaneous access > to a dbm file from different processes. > > As an alternative, if you're only dealing with 1 server process (e.g. > apache2 on windows), python's threading module does a good enough job > (Lock/RLock objects). I find python's native locking mechanisms > adequate for protecting the critical areas of my code across threads in > apache. > > Nick > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|