This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: LoadLibrary error 487 (was Re: Please test latest developer snapshot)
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-developers at cygwin dot com
- Date: Tue, 1 Mar 2011 18:53:00 +0100
- Subject: Re: LoadLibrary error 487 (was Re: Please test latest developer snapshot)
- References: <20110227213703.GC413@calimero.vinschen.de> <20110228005736.GA31571@ednor.casa.cgf.cx> <20110228100146.GD413@calimero.vinschen.de> <20110228194957.GA29573@ednor.casa.cgf.cx> <20110228201533.GC25554@calimero.vinschen.de> <20110228202021.GD25554@calimero.vinschen.de> <20110228215906.GB11525@ednor.casa.cgf.cx> <20110228221010.GA22240@calimero.vinschen.de> <20110301091102.GB22240@calimero.vinschen.de> <20110301145821.GC21730@ednor.casa.cgf.cx>
- Reply-to: cygwin-developers at cygwin dot com
On Mar 1 09:58, Christopher Faylor wrote:
> On Tue, Mar 01, 2011 at 10:11:02AM +0100, Corinna Vinschen wrote:
> >On Feb 28 23:10, Corinna Vinschen wrote:
> >> On Feb 28 16:59, Christopher Faylor wrote:
> >> > I have something like that sitting in my sandbox but I named the flag
> >> > "use_dont_resolve_hack". Actually "need_dont_resolve_hack" would
> >> > probably be better.
> >> >
> >> > But, at this point, it's nickel and dime so whatever you want to
> >> > call it is fine.
> >>
> >> "use_dont_resolve_hack" is fine with me. If you check it in tonight,
> >> I'll create 1.7.8 from there tomorrow morning.
> >
> >Talking about 1.7.9, is there perhaps a way to get rid of the multimedia
> >timer in times.cc? This would restrict the usage of winmm to /dev/dsp.
> >Dumb question: Can't we just use the 64 bit uptime counter from the
> >KUSER_SHARED_DATA area?
>
> No, there really isn't. This has already been discussed and rediscussed over
> the years.
My brain is a bit fuzzy in terms of remembering this stuff. Did we ever
discussed to use a waitable timer? This only requires ntdll functions.
I think this is how winmm implements timeGetTime.
I made a quick test and the returned values look pretty good in
terms of stability. 15.625 ms on XP vs. 15.6 ms on W7 without any
weird jitter.
Corinna
--- SNIP ---
#include <stdio.h>
#include <stdlib.h>
#include <ddk/ntddk.h>
typedef enum _TIMER_INFORMATION_CLASS {
TimerBasicInformation
} TIMER_INFORMATION_CLASS;
typedef struct _TIMER_BASIC_INFORMATION {
LARGE_INTEGER TimeRemaining;
BOOLEAN SignalState;
} TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
NTOSAPI
NTSTATUS
DDKAPI
NtQueryTimer(
/*IN*/ HANDLE TimerHandle,
/*IN*/ TIMER_INFORMATION_CLASS TimerInformationClass,
/*OUT*/ PVOID TimerInformation,
/*IN*/ ULONG TimerInformationLength,
/*OUT*/ PULONG ReturnedLength /*OPTIONAL*/);
int main(int argc, char* argv[])
{
NTSTATUS status;
HANDLE timer;
LARGE_INTEGER duetime;
PTIMER_BASIC_INFORMATION tbi;
int cnt = 100, i;
long long lastTimer = 0;
duetime.QuadPart = -10000000000LL;
tbi = (PTIMER_BASIC_INFORMATION)
malloc (cnt * sizeof (TIMER_BASIC_INFORMATION));
if (!tbi)
{
printf ("malloc failed\n:");
return 1;
}
status = NtCreateTimer (&timer, TIMER_ALL_ACCESS, NULL, NotificationTimer);
if (!NT_SUCCESS (status))
{
printf ("NtCreateTimer: %p\n", status);
return 1;
}
status = NtSetTimer (timer, &duetime, NULL, NULL, FALSE, 1000000L, NULL);
if (!NT_SUCCESS (status))
{
printf ("NtSetTimer: %p\n", status);
return 1;
}
for (i = 0; i < cnt; ++i)
{
do
{
NtQueryTimer (timer, TimerBasicInformation, tbi + i, sizeof *tbi,
NULL);
//Sleep(1);
}
while (tbi[i].TimeRemaining.QuadPart
== tbi[i - 1].TimeRemaining.QuadPart);
}
NtCancelTimer (timer, NULL);
NtClose (timer);
for (i = 1; i < cnt; ++i)
printf("Timer: %lld, dTimer: %lld usec\n",
tbi[i].TimeRemaining.QuadPart,
(tbi[i - 1].TimeRemaining.QuadPart
- tbi[i].TimeRemaining.QuadPart) / 10);
return 0;
}
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat