This is the mail archive of the
mailing list for the GDB project.
async codeing convention
- To: GDB Discussion <gdb at sources dot redhat dot com>
- Subject: async codeing convention
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 19 Feb 2001 22:32:38 -0500
Hmm, a tuffy
If async is going to be implemented, GDB will end up with numerous
chunks of code with asynchronous interfaces.
At present serial.h has the interface:
serial_read (sd, buffer, len)
returns SERIAL_TIMEOUT if the
device isn't ready.
serial_write (sd, buffer, len)
At present just assumes the writes don't block :-(
serial_async (sd, handler, context)
cal hander() when SD probably has data
available for reading.
(The obvious extension is to add
a write callback).
The interface was selected (internal to Cygnus) because it allowed both
synchronous and asynchronous code to work.
I'd like to establish a convention for how these interfaces should be
implemented. The obvious move is to just adopt something very similar
to serial.c and I don't have any problems with that :-)
What I'm looking for is comments from people that have hacked on GDB's
existing async code. However, general comments, such as pointers to
coding standards and examples would also really be appreciated.