Re: Proper way to provide gtk+ app with asynchronous data?



Paul Davis wrote:

just be sure to be aware that this is not a good design if the
data-sending thread is under hard or soft real-time constraints. you
should never force synchronization between the GUI and a real-time
thread, because it can cause the RT thread to block for an unbounded
period. use lock-free techniques (such as single-reader/single-writer
ringbuffers) and/or pipes.


Additionally, you 1) will need some mechanism to make sure that things doesn't go bananas if the receiver can't keep up with long-term average data bandwidth, so it's not as easy as just putting a buffer in between, and 2) you have a data "ownership" problem where thread A passes ownership of the data it produces to thread B, which can easily cause memory leaks if you're not careful.

Bottom line beeing that if you're _not_ having any realtime constraints, it could vice-versa be a good design decision to avoid asynchronous mechanisms, because they add unnecessary complexity.

--
Christer Palm



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]