def ensure_running(self):
with self._lock:<EOL><INDENT>if self._fd is not None:<EOL><INDENT>if self._check_alive():<EOL><INDENT>return<EOL><DEDENT>os.close(self._fd)<EOL>try:<EOL><INDENT>os.waitpid(self._pid, <NUM_LIT:0>)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT>self._fd = None<EOL>self._pid = None<EOL>warnings.warn('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>fds_to_pass = []<EOL>try:<EOL><INDENT>fds_to_pass.append(sys.stderr.fileno())<EOL><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT>r, w = os.pipe()<EOL>cmd = '<STR_LIT>'.format(<EOL>main.__module__, r, VERBOSE)<EOL>try:<EOL><INDENT>fds_to_pass.append(r)<EOL>exe = spawn.get_executable()<EOL>args = [exe] + util._args_from_interpreter_flags()<EOL>if sys.version_info[:<NUM_LIT:2>] <= (<NUM_LIT:3>, <NUM_LIT:3>):<EOL><INDENT>import re<EOL>for i in range(<NUM_LIT:1>, len(args)):<EOL><INDENT>args[i] = re.sub("<STR_LIT>", "<STR_LIT>", args[i])<EOL><DEDENT><DEDENT>args += ['<STR_LIT:-c>', cmd]<EOL>util.debug("<STR_LIT>".format(args))<EOL>try:<EOL><INDENT>if _HAVE_SIGMASK:<EOL><INDENT>signal.pthread_sigmask(signal.SIG_BLOCK,<EOL>_IGNORED_SIGNALS)<EOL><DEDENT>pid = spawnv_passfds(exe, args, fds_to_pass)<EOL><DEDENT>finally:<EOL><INDENT>if _HAVE_SIGMASK:<EOL><INDENT>signal.pthread_sigmask(signal.SIG_UNBLOCK,<EOL>_IGNORED_SIGNALS)<EOL><DEDENT><DEDENT><DEDENT>except BaseException:<EOL><INDENT>os.close(w)<EOL>raise<EOL><DEDENT>else:<EOL><INDENT>self._fd = w<EOL>self._pid = pid<EOL><DEDENT>finally:<EOL><INDENT>os.close(r)<EOL><DEDENT><DEDENT>
Make sure that semaphore tracker process is running.

        This can be run from any process.  Usually a child process will use
        the semaphore created by its parent.