3 # Copyright 2011 Facebook
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
17 """Interfaces for platform-specific functionality.
19 This module exists primarily for documentation purposes and as base classes
20 for other tornado.platform modules. Most code should import the appropriate
21 implementation from `tornado.platform.auto`.
24 from __future__ import absolute_import, division, print_function, with_statement
27 def set_close_exec(fd):
28 """Sets the close-on-exec bit (``FD_CLOEXEC``)for a file descriptor."""
29 raise NotImplementedError()
33 """A socket-like object that can wake another thread from ``select()``.
35 The `~tornado.ioloop.IOLoop` will add the Waker's `fileno()` to
36 its ``select`` (or ``epoll`` or ``kqueue``) calls. When another
37 thread wants to wake up the loop, it calls `wake`. Once it has woken
38 up, it will call `consume` to do any necessary per-wake cleanup. When
39 the ``IOLoop`` is closed, it closes its waker too.
42 """Returns the read file descriptor for this waker.
44 Must be suitable for use with ``select()`` or equivalent on the
47 raise NotImplementedError()
49 def write_fileno(self):
50 """Returns the write file descriptor for this waker."""
51 raise NotImplementedError()
54 """Triggers activity on the waker's file descriptor."""
55 raise NotImplementedError()
58 """Called after the listen has woken up to do any necessary cleanup."""
59 raise NotImplementedError()
62 """Closes the waker's file descriptor(s)."""
63 raise NotImplementedError()