Paul Durrant wrote:
On 4/24/07, Anders Persson <[EMAIL PROTECTED]> wrote:
> - I think the ksock_callback_t passed to ksock_accept() is slightly
> confusing. Is it really necessary for an accepted socket to
> immediately have callbacks? It would be more straightforward if the
> thread calling ksock_accept() simply called ksock_callback() upon its
> return.
The issue with that is that an event might be missed, and the user would
have to check for "pending" events after registering the callbacks. The
current approach allows the user to do what you want by simply passing
in NULL for the last two arguments. Another approach would be to provide
two versions of accept; one that has the "regular" accept behavior, and
another that allows for callback registration.
This yeilds another question then. When I add a callback function to
an existing socket using ksock_callback() do I not get notification of
pending events? I.e. if the socket is connected and already has data,
do I not get told about that?
Right, there is no mechanism in place to notify the user about events
that have already take place. If the event happens, and there is no
callback registered, the notification is lost. So if callbacks are
registered after the ksock_accept(), then the user would have to use
ksock_recv() to find out about data that arrived before the registration
took place.
Anders
_______________________________________________
networking-discuss mailing list
[email protected]