<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV><SPAN class=678575314-16082006><FONT face=Arial color=#0000ff size=2>If
your application works as expected before converting to a service, there should
be no problem getting it working as a service. At the most basic level,
your service's main thread can do nothing more than interact with the service
control manager, and your application code should be able to run in its own
thread, quite independent of the service interactions. The only minor
complication will be to have the main service thread communicate service
shutdown to your app code.</FONT></SPAN></DIV>
<DIV><SPAN class=678575314-16082006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=678575314-16082006><FONT face=Arial color=#0000ff size=2>Can
you be more specific about what problems you are having?</FONT></SPAN></DIV>
<DIV><SPAN class=678575314-16082006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=678575314-16082006><FONT face=Arial color=#0000ff
size=2>Mark</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]<B>On
Behalf Of </B>Christopher A. Nethery<BR><B>Sent:</B> Wednesday, 16 August 2006
9:11 AM<BR><B>To:</B> python-win32@python.org<BR><B>Subject:</B>
[python-win32] Multithreaded Service<BR><BR></FONT></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: Arial">I am new to this group, but I'm
hoping someone could offer some advice as to a complicated issue I am
having.<BR><BR>I have created a (multithreaded) Python application that
performs asynchronous queries. Unfortunately, I'm having a very difficult time
setting it up as a service.<BR><BR>It should run as follows:<BR><BR>1) A
remote server starts the service<BR>2) while the service is running, it
performs its asynchronous lookups--something like:<BR><BR>while
1:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: Arial">ASYNCH_QUERY()<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: Arial">time.sleep(30)<BR>else:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: Arial">sys.exit()<BR><BR>I have taken a
look at the pipeTestServiceClient.py and pipeTestService.py examples from
win32all build 209, but I couldn't figure out how to adapt it to my own code,
since nothing needs to be echoed back to the "invoking" server. Does anyone
have any ideas?<BR><BR><BR>Thanking you in
advance,<BR><BR>CAN</SPAN></FONT><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>