mailru / easygo

Tools for building go apps.
MIT License
673 stars 123 forks source link

Resume() call directly inside desc's callback is safe in current implementation. Should remove that note from the comment. #8

Open zhuyie opened 6 years ago

zhuyie commented 6 years ago

in the epoll/kqueue implementation, when callback invoked, no locks been held. looks like it's safe to call Resume() in callback.

but the following comment made me confused.

    // Start adds desc to the observation list.
    //
    // Note that if desc was configured with OneShot event, then poller will
    // remove it from its observation list. If you will be interested in
    // receiving events after the callback, call Resume(desc).
    //
    // Note that Resume() call directly inside desc's callback could cause
    // deadlock.
    //
    // Note that multiple calls with same desc will produce unexpected
    // behavior.
    Start(*Desc, CallbackFn) error