P.S. What are you trying to accomplish? Web2py has a scheduler which
takes care of running background tasks in parallel.

Massimo

On Oct 16, 3:38 pm, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> You should not start threads within actions because they are already
> running into threads created by the web sever. The web server monitors
> the threads and kills them on timeout.
>
> Moreover you are used the db object in the thread. That is not thread
> safe. Every thread should have its own db connection. Web2py handles
> this for you (every action runs in its own thread and has its own db)
> but you break it if you make your own threads.
>
> On Oct 16, 3:22 pm, Harshad <hash0...@gmail.com> wrote:
>
>
>
>
>
>
>
> > class Worker(threading.Thread):
> >     def run(self):
> >         print self.name, "running..."
> >         while True:
> >             if db(db.temperature).isempty():
> >                 print "empty"
> >             else:
> >                 print "not empty"
> >             time.sleep(1)
>
> > Running the above code causes the application to seg fault. Any ideas?

Reply via email to