[Stackless] Stackless Python windows Service

Hans Rakotomanga -X (hrakotom - GFT Technologies SARL at Cisco) hrakotom at cisco.com
Mon Apr 27 18:07:51 CEST 2009


Hi everyone,
 
New to stackless, but loving it so far :)
 
I have a small issue:
I use the uthread library to run my stuff, but not sure if it's related.
 
 
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.
 
Also, I don't see any threads running.
 
Here's a basic run down of what i do:
 
 
define tasklet functions
create Tasklets
 
 
class SERVER(win32serviceutil.ServiceFramework):
    """NT Service."""
    
    _svc_name_          = "SERVER"
    _svc_display_name_  = "SERVER"
        
    # Only exists on Windows 2000 or later, ignored on windows NT
    _svc_description_ = "Python Web Service"
 
    def __init__(self, args):
        win32serviceutil.ServiceFramework.__init__(self, args)
        # create an event that SvcDoRun can wait on and SvcStop
        # can set.
        self.stop_event = win32event.CreateEvent(None, 0, 0, None)
    
    def SvcDoRun(self):
 
        serviceName = self._svc_name_

        uthread.run()
        # now, block until our event is set...
        win32event.WaitForSingleObject(self.stop_event,
win32event.INFINITE)
 
 
Seeing this again, maybe i need to create the tasklets within the class
? Or is the win32Event.Wait incompatible withstacklessand i need to find
another way?
 
--Hans
 
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090427/31b9a8a9/attachment.htm>


More information about the Stackless mailing list