[Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic

Benoît Minisini gambas at ...1...
Sat Dec 5 20:48:26 CET 2009


> >
> > Benoit,
> >
> > runned valgrind tool for a while.
> >
> > And I got a rather strange winner, I got 3 milion calls of _add_char in
> > gb_error.c
> >
> > Some debug code hanging around or something like that?
> >
> > See attached valgrind file.
> >
> > Regards,
> > Ron_2nd.
> 
> The reason is a lot of one-byte reading that raises the EOF error. This
>  should be logical if the read event handler is called whereas there is
>  nothing to read, and then you read one byte.
> 
> But why Linux tells me (the interpreter actually) that there is something
>  to read on the serial port file descriptor, whereas there is nothing?
> 
> Regards,
> 

Hmm. I tested the SerialPort example by sending data to it, and I don't see 
any CPU consumption.

What happens if you don't read the data byte by byte, but all the available 
data at once, as the SerialPort example does? This way:

PUBLIC SUB MySerialPort_Read()
  DIM s AS String
  READ #MySerialPort, s, Lof(MySerialPort) 
  ...
END

-- 
Benoît Minisini




More information about the User mailing list