llvm-project/lldb/source/Utility/TimeSpecTimeout.cpp
Greg Clayton e48310dc6b Added a kqueue class which isn't being used yet, but was part of trying to work around the limitations with the unix select() call and how it is limited to FD_SETSIZE file descriptors.
Also added a TimeSpecTimeout class which can be used with any calls that take a "struct timespec *" as an argument. It is used by the KQueue class.

Also updated some project settings.

llvm-svn: 175377
2013-02-16 22:46:58 +00:00

49 lines
1.2 KiB
C++

//===--------------------- TimeSpecTimeout.cpp ------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "TimeSpecTimeout.h"
using namespace lldb_private;
const struct timespec *
TimeSpecTimeout::SetAbsoluteTimeoutMircoSeconds32 (uint32_t timeout_usec)
{
if (timeout_usec == UINT32_MAX)
{
m_infinite = true;
}
else
{
m_infinite = false;
TimeValue time_value(TimeValue::Now());
time_value.OffsetWithMicroSeconds(timeout_usec);
m_timespec = time_value.GetAsTimeSpec();
}
return GetTimeSpecPtr ();
}
const struct timespec *
TimeSpecTimeout::SetRelativeTimeoutMircoSeconds32 (uint32_t timeout_usec)
{
if (timeout_usec == UINT32_MAX)
{
m_infinite = true;
}
else
{
m_infinite = false;
TimeValue time_value;
time_value.OffsetWithMicroSeconds(timeout_usec);
m_timespec = time_value.GetAsTimeSpec();
}
return GetTimeSpecPtr ();
}