Re: Delay inside a worker thread

From: Ian Semmel (isemmel_at_removejunkmailrocketcomp.com.au)
Date: 01/25/05


Date: Wed, 26 Jan 2005 07:21:37 +1000

I think that what you have to do is ditch the worker thread and the sleep, and
instead opt for UI threads.

You can have multiple layers of threads with the controlling thread looking
after the timers and logical device state etc.

Create invisible windows and use PostMessage to communicate between the threads
(you should logically be using PostThreadMessage, but because of a fundamental
design flaw in Windows they are useless).

Tulio wrote:
> Hello again
>
> Thanks for the help Andy.
> I'm using Windows 2000 and Windows XP, Visual Studio .NET2003 and C++ with
> MFC (no .NET framework is used).
>
> About the board and API I think that I wasn't very clear in my explanation.
> The problem is not to let tool on/off for some period of time. Is more like
> switch the tool on, wait x seconds then execute next block of C++ code. I
> really would appreciate if the manufacturer had provided a function that will
> wait xx seconds after the port was set, but that is not the case ... This
> board has 4 ports, each one has 7 bits. Setting the bits in a particular port
> turns that I/O line on/off, but the function expetcs to receive a bitmap of
> bits to set. So all bits on that port are set at once.
>
> I'm looking at that link and I think that CreateWaitableTimer can do the
> trick. Since we design that part of code in a more procedural way rather than
> event-drive I think it can be more easily adapted.
>
> Many thaks !
>
> "Andy Mortimer [MS]" wrote:
>
>
>>Hi,
>>Which verson of windows are you using, and which compiler are you
>>developing with?
>>
>>Does the board manufacturer provide callbacks which you can register for
>>i.e. tell me when the status of something is such and such, then you get a
>>hardware interupt which is signalled to your callback function in real
>>time? They may even provide hardware timers which you can program and
>>register for notification.
>>
>>Alternatively, you can use a multimedia timers
>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/ht
>>m/_win32_about_multimedia_timers.asp
>>
>>To be honest though, it sounds like your hardware and driver set is a
>>little bit lacking. You can turn a tool on, and you can turn it off, so why
>>can't you turn it on for a specific period of time. This should be provided
>>by the device driver, you should simply have to call an API with an On Off
>>flag and a period of time. Alternatively, the driver should inform you when
>>the operation has completed with a callback.
>>
>>Andy Mortimer [MS]
>>Please do not send email directly to this alias. This alias is for
>>newsgroup purposes only
>>
>>This posting is provided "AS IS" with no warranties, and confers no rights.
>>OR if you wish to include a script sample in your post please add "Use of
>>included script samples are subject to the terms specified at
>>http://www.microsoft.com/info/cpyright.htm"
>>
>>
>>
>>



Relevant Pages

  • Re: Device Driver that uploads its own code?
    ... driver to implement an adaptive timing loop; ... respond/interact with hardware with microsecond precision. ... real-time and linear, the idea of fluctuating state and variable latency ... where the connection to Windows is largely ...
    (microsoft.public.win32.programmer.kernel)
  • RE: After Reboot Get an error message "Seriours Error" Help Please
    ... have not added any hardware to my HP Pavilion a450n system or software. ... OCA either reports a failure in a device driver or video card. ... drivers are up to date and Windows certified. ... For additional details see the link to error code ...
    (microsoft.public.windowsxp.help_and_support)
  • RE: After Reboot Get an error message "Seriours Error" Help Please
    ... What are the Windows error codes? ... device drivers or incompatible hardware. ... Driver Verifier to Troubleshoot Device Drivers in Windows 2000 may help." ... For additional details see the link to error code ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Video Mode 13h in windows XP ... impossible?
    ... >> but this goes a bit deeper and needs hardware specific routines, ... I was thinking.Would it be possible to install a driver ... > windows to record anything send to the Nvidia driver and from the ... of any reason why it couldn't work...basically, write a display device ...
    (alt.lang.asm)
  • RE: Delay inside a worker thread
    ... hardware interupt which is signalled to your callback function in real ... register for notification. ... by the device driver, you should simply have to call an API with an On Off ... the operation has completed with a callback. ...
    (microsoft.public.vc.mfc)