Use atomic functions where appropriate

Also, rename atomic functions to be consistent with the rest of the
platform/threading functions, and move atomic functions to threading*
files rather than platform* files
This commit is contained in:
jp9000
2014-03-16 18:26:46 -07:00
parent 3ed647b8a0
commit 154e0c59e1
15 changed files with 84 additions and 76 deletions

View File

@@ -15,6 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "util/threading.h"
#include "graphics/math-defs.h"
#include "obs-scene.h"
@@ -373,7 +374,7 @@ static void obs_sceneitem_destroy(obs_sceneitem_t item)
void obs_sceneitem_addref(obs_sceneitem_t item)
{
if (item)
++item->ref;
os_atomic_inc_long(&item->ref);
}
void obs_sceneitem_release(obs_sceneitem_t item)
@@ -381,7 +382,7 @@ void obs_sceneitem_release(obs_sceneitem_t item)
if (!item)
return;
if (--item->ref == 0)
if (os_atomic_dec_long(&item->ref) == 0)
obs_sceneitem_destroy(item);
}