Using SunView's notify_set_input_func()?

Eric Bosch maccs!bosch at gpu.utcs.toronto.edu
Fri Dec 16 18:31:00 AEST 1988


A question:

I'm in the process of writing a SunView application that reads input
asynchronously from one or more file descriptors.  To not block on input,
I've used (as suggested in the Programmer's Guide) notify_set_input_func()
to register an input event handler.  When input from any file descriptor
has finished, I've closed the file descriptor and used

	notify_set_input_func( handle, my_input_func, NOTIFY_FUNC_NULL );

to unregister `something'.  My question is: what is `something'?  The main
text of the Notifier section of the Programmer's Guide states:

	"When you close any file descriptor that has been registered
	with the Notifier you should unregister it.  To do this, call
	notify_set_input_func() with a notify_func of NOTIFY_FUNC_NULL."

I interpret this as `unregister the file descriptor'.  However, a footnote
to the same page states:

	"This method of passing in a NOTIFY_FUNC_NULL to unregister an
	event handler from the Notifier works for any type of event."

I interpret this as `unregister the event handler'.  My assumption is that
the latter interpretation is the correct one, but I'm not entirely
convinced.  Anyone know for sure??

I stumbled across this `discrepancy' when debugging my input notify
function.  When input from any file descriptor is exhausted, I close it
and unregister it.  However, I've noticed that later in the program's
execution, subsequent calls to the input function are still being made
with the closed (and presumably, unregistered) file descriptor!

Am I missing something?  Any pointers would be greatly appreciated.

Thanks in advance,
-Eric

Eric Bosch, Dept of CE&B, McMaster University Health Sciences Centre,
Hamilton, Ontario, CANADA	bosch at maccs.mcmaster.ca



More information about the Comp.sys.sun mailing list