<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>Hi
everyone,</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>New to stackless,
but loving it so far :)</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>I have a small
issue:</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>I use the uthread
library to run my stuff, but not sure if it's related.</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>Also, I don't see
any threads running.</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>Here's a basic run
down of what i do:</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>define tasklet
functions</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>create
Tasklets</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>class
SERVER(win32serviceutil.ServiceFramework):<BR> """NT
Service."""<BR> <BR>
_svc_name_ =
"SERVER"<BR> _svc_display_name_ =
"SERVER"<BR> <BR>
# Only exists on Windows 2000 or later, ignored on windows
NT<BR> _svc_description_ = "Python Web
Service"</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>
def __init__(self, args):<BR>
win32serviceutil.ServiceFramework.__init__(self,
args)<BR> # create an event that
SvcDoRun can wait on and SvcStop<BR> #
can set.<BR> self.stop_event =
win32event.CreateEvent(None, 0, 0, None)<BR>
<BR> def SvcDoRun(self):</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2> serviceName =
self._svc_name_<BR></FONT></SPAN><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2><STRONG>
uthread.run()</STRONG></FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2> # now, block until our event
is set...<BR>
win32event.WaitForSingleObject(self.stop_event,
win32event.INFINITE)</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial size=2>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?</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2>--Hans</FONT></SPAN></DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=621310016-27042009><FONT face=Arial
size=2></FONT></SPAN> </DIV></BODY></HTML>