Skip to content
  • This project
    • Loading...
  • Sign in

Barry / rf-depot

Go to a project
Toggle navigation
Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Graphs
  • Network
  • Create a new issue
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Network
  • Compare
  • Branches
  • Tags
Switch branch/tag
  • rf-depot
  • sw
  • bbplayer
  • libultra
  • monegi
  • debug
  • atomic.c
  • root's avatar
    initial commit · bc83a1ad
    bc83a1ad
    root committed 2020-05-02 05:58:04 +0000
atomic.c 304 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include "os.h"
#include "os_internal.h"

/* Atomically decrement the integer */
/* Return 1: success, 0: fail */
int __osAtomicDec(unsigned int *p)
{
	u32 mask;
	int result;

	mask = __osDisableInt();
	if (*p > 0) {
		(*p)--;
		result = 1;
	} else
		result = 0;
	__osRestoreInt(mask);
	return result;
}