diff options
author | Michael Stahl <mst@openoffice.org> | 2011-03-28 10:34:17 +0000 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-03-28 10:34:17 +0000 |
commit | b33afb6c8b7410bf299941f9d52f5cc558df3fd4 (patch) | |
tree | 1498c2d69559e4352d817b274e73475215a8ac58 /avmedia/source | |
parent | 0398365fafa23bd9d8f8548654b7b068ad561ea5 (diff) |
solaris11: #i117566#: gstreamer: Sun C++ complains about bogus atomic int abuse
Diffstat (limited to 'avmedia/source')
-rw-r--r-- | avmedia/source/gstreamer/gstplayer.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index ba354fe5f274..614ff80ce352 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -415,10 +415,14 @@ double SAL_CALL Player::getRate() void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) throw( uno::RuntimeException ) { - if( bSet && !isPlaybackLoop() ) - g_atomic_int_inc( &mnLooping ); - else if( !bSet && isPlaybackLoop() ) - g_atomic_int_dec_and_test( &mnLooping ); + if (bSet) + { + g_atomic_int_compare_and_exchange(&mnLooping, 0, 1); + } + else + { + g_atomic_int_compare_and_exchange(&mnLooping, 1, 0); + } } // ------------------------------------------------------------------------------ @@ -810,16 +814,12 @@ void Player::implHandleNewPadFunc( GstElement* pElement, // ------------------------------------------------------------------------------ gboolean Player::idle() { - // test if main loop should quit and set flag mnQuit to 1 - bool bQuit = g_atomic_int_compare_and_exchange( &mnQuit, 1, 1 ); + // test if main loop should quit by comparing with 1 + // and set flag mnQuit to 0 so we call g_main_loop_quit exactly once + bool const bQuit = g_atomic_int_compare_and_exchange( &mnQuit, 1, 0 ); if( bQuit ) { - // set mnQuit back to 0 to avoid mutiple g_main_loop_quit calls - // in case Player::idle() is called again later; - // the flag should have been set only once within Ctor called from - // the application thread - g_atomic_int_dec_and_test( &mnQuit ); g_main_loop_quit( mpLoop ); } |