Problems with Event Queue
Andrew Myers
andru at sgi.com
Thu Jun 14 03:20:53 AEST 1990
In article <14653 at thorin.cs.unc.edu> surles at robinett.cs.unc.edu (Mark Surles) writes:
>Is there any way to get both the event type and the value
>without dequeueing the event? Or, can I read the event and then
>somehow put it back at the FRONT of the queue?
>Mark Surles
>surles at cs.unc.edu
You could implement a wrapper around qtest/qread, whose implementation
would depend on how deep a pushback you needed. If you only need one
level, something like this should suffice:
#include "gl.h"
#include "assert.h"
long q_dev;
short q_data;
int q_hasdata;
long my_qtest()
{
if (q_hasdata) return q_dev;
else return qtest();
}
long my_qread(short *data)
{
if (q_hasdata) {
*data = q_data;
return q_dev;
} else {
return qread(data);
}
}
void my_qunread(long dev, short data)
{
assert(!q_hasdata); /* one level pushback requirement */
assert(dev != 0); /* dev==0 wouldn't make sense */
q_dev = dev;
q_data = data;
}
-----
Andrew
More information about the Comp.sys.sgi
mailing list