Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Fix keyboard interrupts when using multiprocessing.pool.imap().
# Usage:
# import fix_multiprocessing.py
from multiprocessing.pool import IMapIterator
def wrapper(func):
def wrap(self, timeout=None):
# Note: the timeout of 1 googol seconds introduces a rather subtle
# bug for Python scripts intended to run many times the age of the universe.
return func(self, timeout=timeout if timeout is not None else 1e100)
return wrap
IMapIterator.next = wrapper(IMapIterator.next)
@gaberosser

This comment has been minimized.

Copy link

gaberosser commented Apr 28, 2015

What a pity, I want to run my code for one googol and one seconds.

@pombredanne

This comment has been minimized.

Copy link

pombredanne commented Nov 11, 2016

@aljungberg what would be the license for this?

@aljungberg

This comment has been minimized.

Copy link
Owner Author

aljungberg commented Feb 13, 2017

@pombredanne sorry for not noticing your message. Let's go with the MIT license for this.

@pombredanne

This comment has been minimized.

Copy link

pombredanne commented Feb 13, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.