[SDL] SDL_WaitEventTimeout

Alan Wolfe atrix2 at cox.net
Thu Nov 6 12:45:01 PST 2003


might the scanner be defective and not be sending all the keys?


----- Original Message -----
From: <barrett at 9hells.org>
To: <sdl at libsdl.org>
Sent: Thursday, November 06, 2003 12:41 PM
Subject: Re: [SDL] SDL_WaitEventTimeout


> On Thu, Nov 06, 2003 at 01:47:49PM -0600, Bob Pendleton wrote:
> > You need to let us know which OS you are running on so we can properly
> > answer the question. Some points to consider.
>
> Linux 2.4.21
>
> > o There is an event queue. If it fills up SDL quietly drops the events.
>
> I looked at the src/events/SDL_events.c, it seems that the queue holds
> 128 events. The barcode reader sends 11 chars, so 22 events, that
> shouldn't be a problem.
>
> > o On most OSes a SDL_Delay(1) will wait for an average of 5
> > milliseconds. That happens because the clock ticks every 10
> > milliseconds. In a tight loop such as the one you describe the delay
> > will tend to synch up with the clock and you will usually delay slightly
> > less than 10 milliseconds.
>
> Well, I'm not able to pass the barcode cards twice in less then 50ms.
>
> > o Event handling is OS specific so, to really understand what is going
> > on you have to look at the code for the OS you are using.
> >
> > My *guess* is that the bar code scanner is send keys very quickly and
> > some of them are getting dropped by the OS. How many characters are
> > being sent? Is the OS buffering them too? If so, how big is its buffer?
> > Is it big enough to hold all the data the card reader is sending? If
> > not, the characters are mostly like being dropped by the OS during the
> > long wait for SDL_Delay(1) to return.
>
> I tested it in the console, and it never miss a key.
>
> > Bob Pendleton
>
> Thanks,
> barrett.
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl





More information about the SDL mailing list