locks.h

Go to the documentation of this file.
00001 /*
00002         libthreads - a threading API for Wii
00003 
00004 Copyright (C) 2011              Alex Marshall <trap15@raidenii.net>
00005 
00006 # This code is licensed to you under the terms of the GNU GPL, version 2;
00007 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
00008 */
00009 
00016 #ifndef __LOCKS_H__
00017 #define __LOCKS_H__
00018 
00020 typedef struct {
00021         u32 curr_locks;
00022         u32 lockcount;
00023 } semaphore_t;
00024 
00030 semaphore_t semaphores_create(int count);
00038 void semaphores_lock(semaphore_t* s);
00048 int semaphores_lock_noblock(semaphore_t* s);
00055 void semaphores_unlock(semaphore_t* s);
00056 
00058 typedef struct {
00059         u32 locked; /* b31: locked b30~b0: pid */
00060 } mutex_t;
00061 
00066 mutex_t mutexes_create(void);
00074 void mutexes_lock(mutex_t* m);
00084 int mutexes_lock_noblock(mutex_t* m);
00090 void mutexes_unlock(mutex_t* m);
00091 
00092 #endif
00093 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated by  doxygen 1.6.3