Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequential handlers and managed threads #40

Merged
merged 5 commits into from
Mar 2, 2017
Merged

Conversation

barrucadu
Copy link
Owner

This is a fairly large conceptual change, so I'm putting it up for some review before I merge it. This PR has two changes:

  1. EventHandlers are now executed sequentially, in the order they appear in the handlers list. So:

    1. the order of execution of handlers is now totally deterministic and up to the programmer; and
    2. handlers should terminate reasonably quickly (which is probably the case anyway).
  2. "Managed" threads are introduced, which are threads which will be killed by the client (by throwing the new Disconnect exception) when it disconnects.

Currently killing the managed threads is not part of the on-disconnect handler, it's done in the disconnect function. This could be changed if people feel that would be better.

CC @liyang @JanGe (by the way, let me know if you don't want me to ping you like this, but you're the only users I know for certain I have, other than myself)

The client now has a collection of threads which it kills on
disconnect, these can be created by the programmer as an `IRC` action
from (for example) event handlers, to manage long-running tasks.
@JanGe
Copy link
Contributor

JanGe commented Feb 21, 2017

Finally found some time to check out your proposal. Sorry for the delay and thanks for maintaining and improving your library!

I really like your approach to managing threads and will very likely use it in my little utility to fork a thread for handling the actual DCC file transfer once released.

@barrucadu barrucadu merged commit 249115e into master Mar 2, 2017
@barrucadu barrucadu deleted the sequential-handlers branch March 2, 2017 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants