gnash-dev
[Top][All Lists]
Advanced

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

Re: [Gnash-dev] Questions about trapezoids, triangle stripper etc.


From: Rob Savoye
Subject: Re: [Gnash-dev] Questions about trapezoids, triangle stripper etc.
Date: Mon, 02 Oct 2006 08:55:17 -0600
User-agent: Thunderbird 1.5.0.7 (X11/20060913)

Udo Giacomozzi wrote:

> s> Initially this was a threading issue, as the opengl backend would use
> s> threads and those were messing the the loading/playing threads layout.
> 
> What about semaphores / spinlocks / critical sections (whatever
> they're called in C++)?

  I've been adding support for locking critical sections of code using
Boost::mutex, which works reasonably well for this. All output via
cout/cerr/stdout needs to be protected this way just to enable printing
to work from multiple threads.

  Briefly to add a mutex, first include this header:
#include <boost/thread/mutex.hpp>
Then make a global variable for the mutex:
static boost::mutex io_mutex;

Adding this in any C++ method locks the critical section, and the lock
expires when the destructor is called for the method:
boost::mutex::scoped_lock lock(io_mutex);

You'd need to add BOOST_CFLAGS and BOOST_LIBS to the Makefile.am. I've
already done this, so if you need to use mutexes, I'll check in that
part of changes. At that point all executables need to be linked with
-lboost_thread and -lpthread.

        - rob -




reply via email to

[Prev in Thread] Current Thread [Next in Thread]