Hi,
On Tue, 22 Nov 2005 16:06:24 -0600, Berger, Daniel wrote> > -----Original Message-----
> > From: Jamey Cribbs [mailto:cribbsj at oakwood.org]
> > Sent: Tuesday, November 22, 2005 2:44 PM
> > To: Berger, Daniel
> > Subject: Win32 Service Timeout command
> >
> >
> > Hi, Dan. I have a quick question. Is there a way to set a timeout
> > variable when starting/creating a win32 service using your package?
> > When I attempt to start a KirbyBase process as a service, I have
> > KirbyBase building in-memory indexes before it returns. This
> > can take a
> > few seconds for large indexes. When I attempt to do this by
> > starting it
> > as a win32 service, it bombs out telling me the application
didn''t
> > respond in a timely manner.
> >
> > If I remove the indexes so that KirbyBase initialization
> > returns a lot
> > sooner, everything works fine. Is there any way to tell
> > win32 service
> > to increase the timeout variable?
> >
> > I looked through the docs and the example programs but didn''t
see
> > anything. I googled and did find something about a "timeout
> > hint", but
> > I don''t know how to apply it to your package.
> >
> > Thanks for any help you can give!
> >
> > Jamey Cribbs
>
> Hi Jamey,
>
> I''ve cc''d the win32utils-devel mailing list for some
additional
> feedback.
>
> Heesob, is this because of the default 2 second WaitHint value that
> StartService() uses?
>
> If so, I think the solution is to allow a "timeout=" option in
the
> Service.create_service method, and wrap the StartService() function in a
> "while dwCurrentState == SERVICE_START_PENDING; sleep(x)" type of
loop.
> I''m basing my opinion on this link:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc
> /base/starting_a_service.asp
>
> Does that seem a reasonable approach?
>
> Of course, this would still mean Jamey would have to guess at a timeout
> value. Is there a better approach in general?
>
> Regards,
>
> Dan
>
I think the following is a reasonable approach.
Call the function
SetTheServiceStatus(SERVICE_START_PENDING, NO_ERROR, checkpoint, 0);
with incremented checkpoint each step of initializing process.
I''m basing my opinion on this link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dllproc/base/service_status_process_str.asp
dwCheckPoint
Check-point value that the service increments periodically to report its
progress during a
lengthy start, stop, pause, or continue operation. For example, the service
should increment this
value as it completes each step of its initialization when it is starting up.
The user interface
program that invoked the operation on the service uses this value to track the
progress of the
service during a lengthy operation. This value is not valid and should be zero
when the service
does not have a start, stop, pause, or continue operation pending.
Regards,
Park Heesob