1

I want to write a program with several interscheduled functions running forever. I thought of using gevent for this purpose. Are their any issues with long running greenlets ?

I am writing a program of this format

from gevent.pool import Pool
from gevent import sleep    

class A(object):
    def a(self):
        while True:
            try:
                * do something *
            except:
                * log exception * 
            sleep(1)

if __name__ == "__main__":
    pool = Pool(5)
    obj = A()
    pool.spawn(obj.a)
    pool.join()
acid_crucifix
  • 362
  • 2
  • 12

1 Answers1

1

Other than obj not being defined in this example it should work fine. It doesn't look like you will have any blocking contention problems or GIL issues in this example. These are the only issues I have seen with long running greenlets. That and memory leaks, but that is not a thread specific problem.

Andrew Johnson
  • 3,078
  • 1
  • 18
  • 24
  • im marking this as the correct answer.. I remember I had decided to wait for any contradictory answers before selecting this, and it slipped my mind completely. – acid_crucifix Dec 11 '14 at 19:39