Re: [Discuss-gnuradio] Thread Synchronization

2009-05-13 Thread Tom Lutz
Please use the boost mutexs: #include boost/thread.hpp boost::mutex m; // the mutex boost::mutex::scoped_lock guard(m)// the scoped guard Eric Would it severely affect performance to create a boost::mutex::scoped_lock inside the function

Re: [Discuss-gnuradio] Thread Synchronization

2009-05-13 Thread Eric Blossom
On Wed, May 13, 2009 at 03:33:41PM -0400, Tom Lutz wrote: I currently have a thread-safe *cue spock brow* way of re-allocating the buffers while the scope is running but it is not as clean as using a mutex (although it is faster, I'm sure). Here's how my method works. Tell me if you think

Re: [Discuss-gnuradio] Thread Synchronization

2009-05-13 Thread Tom Lutz
This might work on x86 machines, but isn't safe on machines with weak memory ordering across processors (e.g., PPC, Itanium). You'd need to introduce architecture specific memory barriers. Can you put the mutex at a higher level (e.g., in the object that has the gr_oscope_guts)? Eric

[Discuss-gnuradio] Thread Synchronization

2009-05-12 Thread Tom Lutz
I'm editing some of the .cc files and would like to know the preferred method for performing thread synchronization in C++ code. In particular, I noticed that the set and get methods that are called on the gr_oscope_guts class originate from a different thread then that of process_samples, and

Re: [Discuss-gnuradio] Thread Synchronization

2009-05-12 Thread Eric Blossom
On Tue, May 12, 2009 at 03:22:47PM -0400, Tom Lutz wrote: I'm editing some of the .cc files and would like to know the preferred method for performing thread synchronization in C++ code. In particular, I noticed that the set and get methods that are called on the gr_oscope_guts class

Re: [Discuss-gnuradio] Thread Synchronization

2009-05-12 Thread Tom Lutz
On Tue, May 12, 2009 at 4:09 PM, Eric Blossom e...@comsec.com wrote: On Tue, May 12, 2009 at 03:22:47PM -0400, Tom Lutz wrote: I'm editing some of the .cc files and would like to know the preferred method for performing thread synchronization in C++ code. In particular, I noticed that