Hi again :P,

Tried as you said but without much success. Well, some: using normal
tasklets and defining the sleeper within the thread, it works.

When I try to use uthread ( would like to keep that one if at all
possible ) it locks up after the first iteration ( changed uthread.Run()
so it goes past the first one ).
I am pretty sure it's something obvious, but I just don't see it.

<code>

import uthread
import time
import random
from threading import Thread

sleepingTasklets = []

def launchThreads():
    def thTest(self):
        while True:
            self.log("Hello")
            uthread.sleep(.1)

    for i in range(0,2):
        t = uthread.Tasklet()
        t.name = "TEST-%s" % str(i).zfill(2)
        t.bind(thTest)(t)

    print "Launching run()"
    uthread.run()

#launchThreads()    

class EThread(Thread):
    shouldRun = True
    def run(self):
        launchThreads()


Th = EThread()
Th.start()

while True:
    print("This is main thread")





 

-----Original Message-----
From: Richard Tew [mailto:[email protected]] 
Sent: Monday, April 27, 2009 6:48 PM
To: Hans Rakotomanga -X (hrakotom - GFT Technologies SARL at Cisco)
Cc: [email protected]
Subject: Re: [Stackless] Stackless Python windows Service

On Mon, Apr 27, 2009 at 12:07 PM, Hans Rakotomanga -X (hrakotom - GFT
Technologies SARL at Cisco) <[email protected]> wrote:
> Basically, I would like to run a couple windows service in the 
> background, however since uthread.run() ( or stackless.run() i suppose

> ) blocks until end of execution, it never reaches the windows block
until event.

If you need to block for Windows events, you need to do it on a separate
thread.  Or conversely, start the tasklets on a separate thread and run
a scheduler on that thread.  Tasklets are created on a per-thread basis.

> Also, I don't see any threads running.

What threads?  Why would they be running?

Cheers,
Richard.

_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless
  • [Stackless... Hans Rakotomanga -X (hrakotom - GFT Technologies SARL at Cisco)
    • Re: [... Richard Tew
      • R... Hans Rakotomanga -X (hrakotom - GFT Technologies SARL at Cisco)
      • R... Hans Rakotomanga -X (hrakotom - GFT Technologies SARL at Cisco)
        • ... Richard Tew
          • ... Hans Rakotomanga -X (hrakotom - GFT Technologies SARL at Cisco)

Reply via email to