# Path: python/gup/log.py
# def getLogger(*a):
# 	logger = logging.getLogger(*a)
# 	logger.addFilter(_color_filter)
# 	return logger
# 
# Path: python/gup/error.py
# class SafeError(Exception):
# 	exitcode = 10
# 	pass
# 
# UNKNOWN_ERROR_CODE = 1


import tempfile
					import traceback
	import fcntl
	import os, errno, select, signal
from .log import getLogger
from .error import SafeError, UNKNOWN_ERROR_CODE
				_debug("done: %r" % pd.name)
				self._release(1)
				os.close(fd)
				del self.waitfds[fd]
				rv = os.waitpid(pd.pid, 0)
				assert(rv[0] == pd.pid)
				_debug("done1: rv=%r" % (rv,))
				rv = rv[1]
				if os.WIFEXITED(rv):
					pd.rv = os.WEXITSTATUS(rv)
				else:
					pd.rv = -os.WTERMSIG(rv)
				_debug("done2: rv=%d" % pd.rv)
				pd.donefunc(pd.rv)

	def _get_token(self, reason):
		"Ensure we have one token available."
		assert(self.tokens <= 1)
		while 1:
			if self.tokens >= 1:
				_debug("self.tokens is %d" % self.tokens)
				assert(self.tokens == 1)
				_debug('(%r) used my own token...' % reason)
				break
			assert(self.tokens < 1)
			_debug('(%r) waiting for tokens...' % reason)
			self.wait(want_token=1)
			if self.tokens >= 1:
				break
			assert(self.tokens < 1)

# Path: python/gup/log.py
# def getLogger(*a):
# 	logger = logging.getLogger(*a)
# 	logger.addFilter(_color_filter)
# 	return logger
# 
# Path: python/gup/error.py
# class SafeError(Exception):
# 	exitcode = 10
# 	pass
# 
# UNKNOWN_ERROR_CODE = 1


# Path: python/gup/parallel.py
import tempfile
					import traceback
	import fcntl
	import os, errno, select, signal
from .log import getLogger
from .error import SafeError, UNKNOWN_ERROR_CODE

				_debug("done: %r" % pd.name)
				self._release(1)
				os.close(fd)
				del self.waitfds[fd]
				rv = os.waitpid(pd.pid, 0)
				assert(rv[0] == pd.pid)
				_debug("done1: rv=%r" % (rv,))
				rv = rv[1]
				if os.WIFEXITED(rv):
					pd.rv = os.WEXITSTATUS(rv)
				else:
					pd.rv = -os.WTERMSIG(rv)
				_debug("done2: rv=%d" % pd.rv)
				pd.donefunc(pd.rv)

	def _get_token(self, reason):
		"Ensure we have one token available."
		assert(self.tokens <= 1)
		while 1:
			if self.tokens >= 1:
				_debug("self.tokens is %d" % self.tokens)
				assert(self.tokens == 1)
				_debug('(%r) used my own token...' % reason)
				break
			assert(self.tokens < 1)
			_debug('(%r) waiting for tokens...' % reason)
			self.wait(want_token=1)
			if self.tokens >= 1:
				break
			assert(self.tokens < 1)

			b = self._try_read(1)