b40ccd947df4b44bdc46f8e50979c6209d11110b
[trex.git] /
1 #!/usr/bin/env python
2 #
3 # Copyright 2011 Facebook
4 #
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
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
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
15 # under the License.
16
17 """Implementation of platform-specific functionality.
18
19 For each function or class described in `tornado.platform.interface`,
20 the appropriate platform-specific implementation exists in this module.
21 Most code that needs access to this functionality should do e.g.::
22
23     from tornado.platform.auto import set_close_exec
24 """
25
26 from __future__ import absolute_import, division, print_function, with_statement
27
28 import os
29
30 if os.name == 'nt':
31     from .common import Waker
32     from .windows import set_close_exec
33 else:
34     from .posix import set_close_exec, Waker
35
36 try:
37     # monotime monkey-patches the time module to have a monotonic function
38     # in versions of python before 3.3.
39     import monotime
40 except ImportError:
41     pass
42 try:
43     from time import monotonic as monotonic_time
44 except ImportError:
45     monotonic_time = None