Moritz Schulte <[EMAIL PROTECTED]> writes:

> error_t
> request_dir_change_notifications ((void) (*callback) (dir_changed_type_t change_type,
>                                                       char *name),
>                                    char *dirname);
w> 
> Which would request dir notifications for DIRNAME and call *CALLBACK
> with the according information whenever a notification message arives.
> 
> Is something like that the right way[tm]?

I think there should also be a place for application specific context,
like

error_t
request_dir_change_notifications (void *ctx,
                                  (void) (*callback) (dir_changed_type_t change_type,
                                                      char *name,
                                                      void *ctx),
                                   char *dirname);

What is it that will invoke the callback? I guess you're thinking that
request_dir_change_notifications should spawn a thread that invokes
the callback whenever anything interesting happens. Sounds right, if
we can assume that the application is prepared to handle multithreading.

Further more, you probably want to return some id that can be used for
cancelling the notification request.

It would be nice to also have a select-friendly interface. I.e. a
function that returns an fd that you can select on, together with all
other fd:s you may have. Closing the fd would cancel the notification
request. Using the read function on the fd might not make sense, but
one could have a specialized function for that.

/Niels

_______________________________________________
Help-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-hurd

Reply via email to