<div dir="ltr">You might want to check out an API that I&#39;ve added as of today: amqp_consume_message():<div><a href="https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp.h#L688">https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp.h#L688</a><br>
<div><br></div><div style>You can find an example on how to use it here:</div><div style><a href="https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c#L81">https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c#L81</a><br>
</div></div><div style><br></div><div style>To specify a timeout for that function you&#39;d create a struct timeval</div><div style><br></div><div style>struct timeval timeout;</div><div style>timeout.tv_sec = 5; /* Wait up to 5.0006 seconds */</div>
<div style>timeout.tv_usec = 6000;</div><div style><br></div><div style>/* Pass timeval into amqp_consume_message() like so. </div><div style>amqp_consume_message(conn, &amp;envelope, &amp;timeout, 0);</div><div style><br>
</div><div style>-Alan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 8, 2013 at 7:05 PM, 3k4b251 <span dir="ltr">&lt;<a href="mailto:314992959@qq.com" target="_blank">314992959@qq.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">can  you  give  me  some  example?<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/rabbitmq-c-non-block-tp27908p27912.html" target="_blank">http://rabbitmq.1065348.n5.nabble.com/rabbitmq-c-non-block-tp27908p27912.html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the RabbitMQ mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div></div></blockquote></div><br></div>