<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<br><br>&gt; To: michael_anonyme@hotmail.com<br>&gt; CC: xorp-hackers@icir.org<br>&gt; Subject: Re: [Xorp-hackers] Timer Event <br>&gt; Date: Wed, 11 Mar 2009 02:07:08 -0700<br>&gt; From: pavlin@ICSI.Berkeley.EDU<br>&gt; <br>&gt; michael anonyme &lt;michael_anonyme@hotmail.com&gt; wrote:<br>&gt; <br>&gt; &gt; <br>&gt; &gt; Hello,<br>&gt; &gt; <br>&gt; &gt; I'm trying to add an event to the EventLoop : <br>&gt; &gt; <br>&gt; &gt; _timeOutVal(TimeVal(10,0)) is initialized in constructor.<br>&gt; &gt; <br>&gt; &gt; I would like that after 10 seconds, Xorp run test_cb method, but it doesn't seems to work.<br>&gt; &gt; <br>&gt; &gt; XorpTimer t = _eventloop.new_oneoff_after(_timeOutVal,callback(this,&amp;ConsensusMain::test_cb));<br>&gt; &gt; <br>&gt; &gt; void ConsensusMain::test_cb() {<br>&gt; &gt;        XLOG_INFO("RUN TEST CALLBACK!!!!!\n");<br>&gt; &gt; }<br>&gt; &gt; <br>&gt; &gt; What did I do wrong??<br>&gt; <br>&gt; If the "XorpTime t" object is destroyed (e.g., if it goes out of<br>&gt; scope), then the timer itself on the eventloop is also destroyed.<br>&gt; You need to save it somewhere (e.g., as a private field in the<br>&gt; ConsensusMain class).<br>&gt; <br>&gt; Hope that helps,<br>&gt; Pavlin<br><br>Thanks it works great!!<br><br /><hr />Rejoignez la nouvelle famille de Windows Live Messenger <a href='http://download.live.com' target='_new'>Cliquez ici!</a></body>
</html>