km4arr / openpgm

Automatically exported from code.google.com/p/openpgm
0 stars 0 forks source link

Handling protocol events in send-only applications. #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What is the recommended way of handling protocol events in a send-only 
application?

Suppose I have a publishing thread that sends some data in a loop. According to 
the docs I must also call one of the receive functions periodically in order to 
advance the pgm state machine. Would it be acceptable if I have a separate 
thread that just calls one of the receive functions in a loop (on the same 
socket)? Will a blocking call do in this case?

void evenProcessinfThread()
{
  for(;;)
  {
    pgm_recv(...);
  }
}

What version of the product are you using? On what operating system?
libpgm-5.1.118

Original issue reported on code.google.com by astov...@gmail.com on 25 Jan 2012 at 5:22

GoogleCodeExporter commented 9 years ago
You can spawn a new thread and have a blocking or non-blocking loop such as 
implemented in the example daytime.c.

Alternatively you can interleave sending and receiving on one thread using an 
event manager such as select(), poll(), etc.  The only example of this 
implementation can be found within http://zero.mq/ as it usually requires 
creation of both send and receive queues above OpenPGM.

Original comment by fnjo...@gmail.com on 26 Jan 2012 at 12:27