Re: How to prevent from race conditions to share data between many process and thread in python
mars a écrit : > I use TurboGears to do some web service. TurboGears use cherrypy. When > web browser access this site, the cherrypy will call my python > program. So my program looks like a lib. When web browser access the > site, the http server will fock a process or gerenate a thread. I need > share some data or operate some files. How can I prevent from race > conditions. Is there any way can I lock this. > Thank you in advance! See in the cookbook: http://aspn.activestate.com/ASPN/search?query=locking&x=0&y=0§ion=PYTHONCKBK&type=Subsection And test/choose one solution... http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252495 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203 ... A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to prevent from race conditions to share data between many process and thread in python
En Tue, 06 Feb 2007 08:49:51 -0300, Diez B. Roggisch <[EMAIL PROTECTED]> escribió: > mars wrote: > >> On 2月6日, 下午6时14分, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >>> mars wrote: >>> > I use TurboGears to do some web service. TurboGears use cherrypy. >>> When >>> > web browser access this site, the cherrypy will call my python >>> > program. So my program looks like a lib. When web browser access the >>> > site, the http server will fock a process or gerenate a thread. I >>> need >>> > share some data or operate some files. How can I prevent from race >>> > conditions. Is there any way can I lock this. >>> > Thank you in advance! >>> >>> There are the Lock and RLock objects available in the module threading. >> >> Can this also lock mutil-process? > > No. You have to use the syncronization tools provided by your OS in that case; maybe using a locked file (fcntl). -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: How to prevent from race conditions to share data between many process and thread in python
mars wrote: > On 2月6日, 下午6时14分, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> mars wrote: >> > I use TurboGears to do some web service. TurboGears use cherrypy. When >> > web browser access this site, the cherrypy will call my python >> > program. So my program looks like a lib. When web browser access the >> > site, the http server will fock a process or gerenate a thread. I need >> > share some data or operate some files. How can I prevent from race >> > conditions. Is there any way can I lock this. >> > Thank you in advance! >> >> There are the Lock and RLock objects available in the module threading. >> >> Diez > > Can this also lock mutil-process? No. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: How to prevent from race conditions to share data between many process and thread in python
On 2月6日, 下午6时14分, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > mars wrote: > > I use TurboGears to do some web service. TurboGears use cherrypy. When > > web browser access this site, the cherrypy will call my python > > program. So my program looks like a lib. When web browser access the > > site, the http server will fock a process or gerenate a thread. I need > > share some data or operate some files. How can I prevent from race > > conditions. Is there any way can I lock this. > > Thank you in advance! > > There are the Lock and RLock objects available in the module threading. > > Diez Can this also lock mutil-process? -- http://mail.python.org/mailman/listinfo/python-list
Re: How to prevent from race conditions to share data between many process and thread in python
mars wrote: > I use TurboGears to do some web service. TurboGears use cherrypy. When > web browser access this site, the cherrypy will call my python > program. So my program looks like a lib. When web browser access the > site, the http server will fock a process or gerenate a thread. I need > share some data or operate some files. How can I prevent from race > conditions. Is there any way can I lock this. > Thank you in advance! There are the Lock and RLock objects available in the module threading. Diez -- http://mail.python.org/mailman/listinfo/python-list
How to prevent from race conditions to share data between many process and thread in python
I use TurboGears to do some web service. TurboGears use cherrypy. When web browser access this site, the cherrypy will call my python program. So my program looks like a lib. When web browser access the site, the http server will fock a process or gerenate a thread. I need share some data or operate some files. How can I prevent from race conditions. Is there any way can I lock this. Thank you in advance! -- http://mail.python.org/mailman/listinfo/python-list