# Path: tornado/platform/interface.py
# def set_close_exec(fd):
#     def fileno(self):
#     def write_fileno(self):
#     def wake(self):
#     def consume(self):
#     def close(self):
# class Waker(object):
# 
# Path: tornado/util.py
# def b(s):
#     return s.encode('latin1')


import errno
import socket
from tornado.platform import interface
from tornado.util import b
                if (not hasattr(errno, 'WSAEADDRINUSE') or
                    detail[0] != errno.WSAEADDRINUSE):
                    # "Address already in use" is the only error
                    # I've seen on two WinXP Pro SP2 boxes, under
                    # Pythons 2.3.5 and 2.4.1.
                    raise
                # (10048, 'Address already in use')
                # assert count <= 2 # never triggered in Tim's tests
                if count >= 10:  # I've never seen it go above 2
                    a.close()
                    self.writer.close()
                    raise socket.error("Cannot bind trigger!")
                # Close `a` and try again.  Note:  I originally put a short
                # sleep() here, but it didn't appear to help or hurt.
                a.close()

        self.reader, addr = a.accept()
        self.reader.setblocking(0)
        self.writer.setblocking(0)
        a.close()
        self.reader_fd = self.reader.fileno()

    def fileno(self):
        return self.reader.fileno()

    def write_fileno(self):
        return self.writer.fileno()

    def wake(self):
        try:

# Path: tornado/platform/interface.py
# def set_close_exec(fd):
#     def fileno(self):
#     def write_fileno(self):
#     def wake(self):
#     def consume(self):
#     def close(self):
# class Waker(object):
# 
# Path: tornado/util.py
# def b(s):
#     return s.encode('latin1')


# Path: tornado/platform/common.py
import errno
import socket
from tornado.platform import interface
from tornado.util import b

                if (not hasattr(errno, 'WSAEADDRINUSE') or
                    detail[0] != errno.WSAEADDRINUSE):
                    # "Address already in use" is the only error
                    # I've seen on two WinXP Pro SP2 boxes, under
                    # Pythons 2.3.5 and 2.4.1.
                    raise
                # (10048, 'Address already in use')
                # assert count <= 2 # never triggered in Tim's tests
                if count >= 10:  # I've never seen it go above 2
                    a.close()
                    self.writer.close()
                    raise socket.error("Cannot bind trigger!")
                # Close `a` and try again.  Note:  I originally put a short
                # sleep() here, but it didn't appear to help or hurt.
                a.close()

        self.reader, addr = a.accept()
        self.reader.setblocking(0)
        self.writer.setblocking(0)
        a.close()
        self.reader_fd = self.reader.fileno()

    def fileno(self):
        return self.reader.fileno()

    def write_fileno(self):
        return self.writer.fileno()

    def wake(self):
        try:

            self.writer.send(b("x"))