[Ace-users] [ace-users] General question re. synchronization
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Fri Feb 8 07:04:42 CST 2008
There are examples of something along the lines of what you're
trying to do in Chapters 6 and 7 of the C++NPv2 book
<www.cs.wustl.edu/~schmidt/ACE/book2/>. These examples use timeouts
on an ACE_Message_Queue<ACE_MT_SYNCH>, which internally uses condition
variables. I recommend you take a look at this stuff and see if it
meets your needs.
>this is more of a general question and not only ACE-related,
>therefor I skip the PRF this time... (I'm using the latest
>I need to write a "datagram sender" that sends some kind of
>datagram in a (more or less...) fixed frequency, say 10Hz.
>The sender receives the data it needs to send from another program
>(the "producer") but in no fixed frequency, i.e. an update can
>occurr any time. The producer is finished and not part of this
>The sender only knows the size of the datagram it's going to send.
>When the producer sends new data the sender obviously needs to
>update its internal buffer and send the new data.
>Now I'm trying to figure out how to synchronize (inside the sender!)
>the receiving of the new data and the sending. Getting an update
>must not block the sending in any way. It needs to stay at its fixed
>frequency. But when an update occurred the next "cycle" of the sending
>side needs to use the new data immediately.
>I think I need:
> - some kind of double-buffering scheme
> - a way to tell the receiving side of the sender (got that?)
> that the sending side has finihed one cycle (condition var. ?)
> - a way to tell the sending side that new data has arrived (
> and that it needs to use the "other" buffer of the double-
> buffering scheme)
>Could anyone help me with a general structure/concept?
>Thanks in advance for any comment
>Stefan Naewe stefan dot naewe at atlas-elektronik dot com
>Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
>Plain text mails only, please http://www.expita.com/nomime.html
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.schmidt at vanderbilt.edu
More information about the Ace-users