A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/SyncObj_8cpp_source.html below:

NCBI C++ ToolKit: src/objtools/pubseq_gateway/cassandra/SyncObj.cpp Source File

42 #include <linux/futex.h> 44 #include <sys/syscall.h> 59  const function

<

bool

()> & is_done_cb,

60  const function

<

void

(

bool

*)> & update_result_cb)

64  if

(timeout_mks != INT_MAX && timeout_mks > 0) {

65

ns = (

int64_t

)timeout_mks * 1000LL;

67

ns = ns % 1000000000L;

75  if

(!rv && timeout_mks) {

80  if

(timeout_mks == INT_MAX) {

90  if

(!rv && timeout_mks > 0) {

98  if

(update_result_cb) {

99

update_result_cb(&rv);

107 void

CFutex::DoWake(

int

waiters)

109  int

rt = syscall(__NR_futex, &

m_Value

, FUTEX_WAKE, waiters,

NULL

);

112  string

(

"CFutex::DoWake: failed, unexpected errno: "

) +

120  struct

timespec timeout = {0, 0};

121  struct

timespec * ptimeout = &timeout;

123  if

(timeout_mks < 0) {

126

timeout.tv_sec = timeout_mks / 1000000L;

127

timeout.tv_nsec = (timeout_mks % 1000000L) * 1000L;

130  while

(syscall(__NR_futex, &

m_Value

, FUTEX_WAIT,

value

, ptimeout, 0, 0) != 0) {

134  return

eWaitResultOkFast;

138  return

eWaitResultTimeOut;

141  string

(

"CFutex::WaitWhile: failed, unexpected errno: "

) +

145  return

eWaitResultOk;

154 CFutex

SSignalHandler::sm_CtrlCPressedEvent;

167

sm_CtrlCPressedEvent.Set(0);

177  sm_WatchThread

= unique_ptr<thread,

function

<void(thread*)> >(

new

thread(

180

signal(SIGINT, [](

int

) {

181

signal(SIGINT, SIG_DFL);

184

SSignalHandler::sm_CtrlCPressedEvent.Inc();

189  while

(SSignalHandler::sm_CtrlCPressedEvent.WaitWhile(

190

SSignalHandler::sm_CtrlCPressedEvent.Inc(),

191

100000) == CFutex::eWaitResultTimeOut && !

sm_Quit

);

195  ERR_POST

(

Trace

<<

"Ctr+C watcher thread: calling closure"

);

205

signal(SIGINT, SIG_DFL);

#define BEGIN_IDBLOB_SCOPE

BEGIN_IDBLOB_SCOPE USING_NCBI_SCOPE

bool WaitCondVar(unsigned int timeout_mks, CFastMutex &mux, CConditionVariable &ev, const function< bool()> &is_done_cb, const function< void(bool *)> &update_result_cb)

Wrapper around Linux's futex.

volatile int m_Value

Value of the futex.

EWaitResult

Type of result returned from WaitValueChange()

static unique_ptr< thread, function< void(thread *)> > sm_WatchThread

static volatile sig_atomic_t sm_CtrlCPressed

SSignalHandler.

static function< void()> sm_OnCtrlCPressed

static volatile bool sm_Quit

static void s_WatchCtrlCPressed(bool enable, function< void()> on_ctrl_c_pressed=NULL)

#define ERR_POST(message)

Error posting with file, line number information but without error codes.

#define NCBI_THROW(exception_class, err_code, message)

Generic macro to throw an exception, given the exception class, error code and message string.

void Trace(CExceptionArgs_Base &args)

static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)

Convert numeric value to string.

bool WaitForSignal(CMutex &mutex, const CDeadline &deadline=CDeadline::eInfinite)

Release mutex and lock the calling thread until the condition variable is signalled.

<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n th

const GenericPointer< typename T::ValueType > T2 value

Multi-threading – classes, functions, and features.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4