def call(self, *args, **kwargs):
        """Call the function inside the rpc thread."""

        with self._lock:
            if not self._running:
                raise RPCNotRunning()

            # Create an object to hold the result of the function call.
            result = _Result()

            # Since we will block while waiting for our function to get called, we
            # can cache our events per thread.
            try:
                event = self._events.event
            except __HOLE__:
                event = self._events.event = threading.Event()
            else:
                event.clear()

            msg = (event, result, args, kwargs)
            self._queue.put(msg)

        # Wait for the message to be processed.
        event.wait()

        assert result.result is not _NULL, "function failed to get called!"

        # Raise any exceptions we've received.
        if isinstance(result.result, BaseException):
            raise result.result
        else:
            return result.result
dataset/ETHPy150Open felix-lang/fbuild/lib/fbuild/rpc.py/RPC.call