1 //===--------------------- TimeSpecTimeout.h --------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef utility_TimeSpecTimeout_h_
11 #define utility_TimeSpecTimeout_h_
13 #include "lldb/Host/TimeValue.h"
15 namespace lldb_private {
23 m_timespec.tv_sec = 0;
24 m_timespec.tv_nsec = 0;
30 //----------------------------------------------------------------------
31 /// Sets the timespec pointer correctly given a timeout relative to the
32 /// current time. This function should be called immediately prior to
33 /// calling the function you will use this timeout with since time can
34 /// elapse between when this function is called and when the timeout is
37 /// @param[in] timeout_usec
38 /// The timeout in micro seconds. If timeout_usec is UINT32_MAX, the
39 /// timeout should be set to INFINITE. Otherwise the current time is
40 /// filled into the timespec and \a timeout_usec is added to the
44 /// If the timeout is INFINITE, then return NULL, otherwise return
45 /// a pointer to the timespec with the appropriate timeout value.
46 //----------------------------------------------------------------------
47 const struct timespec *
48 SetAbsoluteTimeoutMircoSeconds32 (uint32_t timeout_usec);
50 //----------------------------------------------------------------------
51 /// Sets the timespec pointer correctly given a relative time in micro
54 /// @param[in] timeout_usec
55 /// The timeout in micro seconds. If timeout_usec is UINT32_MAX, the
56 /// timeout should be set to INFINITE. Otherwise \a timeout_usec
57 /// is correctly placed into the timespec.
60 /// If the timeout is INFINITE, then return NULL, otherwise return
61 /// a pointer to the timespec with the appropriate timeout value.
62 //----------------------------------------------------------------------
63 const struct timespec *
64 SetRelativeTimeoutMircoSeconds32 (uint32_t timeout_usec);
66 //----------------------------------------------------------------------
67 /// Gets the timespec pointer that is appropriate for the timeout
68 /// specified. This function should only be used after a call to
69 /// SetRelativeTimeoutXXX() functions.
72 /// If the timeout is INFINITE, then return NULL, otherwise return
73 /// a pointer to the timespec with the appropriate timeout value.
74 //----------------------------------------------------------------------
75 const struct timespec *
76 GetTimeSpecPtr () const
84 struct timespec m_timespec;
88 } // namespace lldb_private
90 #endif // #ifndef utility_TimeSpecTimeout_h_