1<!-- Creator : groff version 1.22.2 --> 2<!-- CreationDate: Sun Feb 5 16:09:43 2017 --> 3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 4"http://www.w3.org/TR/html4/loose.dtd"> 5<html> 6<head> 7<meta name="generator" content="groff -Thtml, see www.gnu.org"> 8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 9<meta name="Content-Style" content="text/css"> 10<style type="text/css"> 11 p { margin-top: 0; margin-bottom: 0; vertical-align: top } 12 pre { margin-top: 0; margin-bottom: 0; vertical-align: top } 13 table { margin-top: 0; margin-bottom: 0; vertical-align: top } 14 h1 { text-align: center } 15</style> 16<title>mtcp_settimer</title> 17 18</head> 19<body> 20 21<h1 align="center">mtcp_settimer</h1> 22 23<a href="#NAME">NAME</a><br> 24<a href="#SYNOPSIS">SYNOPSIS</a><br> 25<a href="#DESCRIPTION">DESCRIPTION</a><br> 26<a href="#RETURN VALUE">RETURN VALUE</a><br> 27<a href="#AUTHORS">AUTHORS</a><br> 28<a href="#SEE ALSO">SEE ALSO</a><br> 29<a href="#COLOPHON">COLOPHON</a><br> 30 31<hr> 32 33 34<h2>NAME 35<a name="NAME"></a> 36</h2> 37 38 39<p style="margin-left:11%; margin-top: 1em">mtcp_settimer 40− register user’s timer-based callback 41handler</p> 42 43<h2>SYNOPSIS 44<a name="SYNOPSIS"></a> 45</h2> 46 47 48<p style="margin-left:11%; margin-top: 1em"><b>#include 49<mos_api.h></b></p> 50 51<p style="margin-left:11%; margin-top: 1em"><b>int 52mtcp_settimer(mctx_t</b> <i>mctx</i><b>, int</b> 53<i>id</i><b>, struct timeval *</b><i>timeout</i><b>, 54callback_t</b> <i>cb</i><b>);</b></p> 55 56<h2>DESCRIPTION 57<a name="DESCRIPTION"></a> 58</h2> 59 60 61 62<p style="margin-left:11%; margin-top: 1em"><b>mtcp_settimer</b>() 63can be used to register callback handler function, <i>cb 64,</i> that is invoked after a time interval of 65<i>timeout</i> microseconds. Note that this callback is a 66one time registration and <i>cb</i> (see 67<b>mtcp_register_callback</b>() for definition) is called 68only once when <i>timeout</i> period expires. The <i>id</i> 69argument is a unique identifier that is passed to <i>cb</i> 70as one of the function arguments.</p> 71 72 73<p style="margin-left:11%; margin-top: 1em"><b>mtcp_settimer</b>() 74call takes an additional argument named <i>mctx</i> that 75represents the per-core mTCP context in an application (see 76<b>mtcp_create_context()</b> for details).</p> 77 78<h2>RETURN VALUE 79<a name="RETURN VALUE"></a> 80</h2> 81 82 83<p style="margin-left:11%; margin-top: 1em">On success 0 is 84returned; -1 on failure.</p> 85 86<h2>AUTHORS 87<a name="AUTHORS"></a> 88</h2> 89 90 91<p style="margin-left:11%; margin-top: 1em">mOS development 92team <[email protected]></p> 93 94<h2>SEE ALSO 95<a name="SEE ALSO"></a> 96</h2> 97 98 99 100<p style="margin-left:11%; margin-top: 1em"><b>mtcp_register_callback</b>(), 101<b>mtcp_socket</b>(),</p> 102 103<h2>COLOPHON 104<a name="COLOPHON"></a> 105</h2> 106 107 108<p style="margin-left:11%; margin-top: 1em">This page is 109part of mOS release 0.3 <i>docs</i> section. A description 110of the project, and information about reporting bugs, can be 111found at http://mos.kaist.edu/.</p> 112<hr> 113</body> 114</html> 115