tkernel_2/lib/libtk/src/liblock.c | bare source | permlink (0.00 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * T-Kernel 2.0 Software Package 4: * 5: * Copyright 2011 by Ken Sakamura. 6: * This software is distributed under the latest version of T-License 2.x. 7: *---------------------------------------------------------------------- 8: * 9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17. 10: * Modified by T-Engine Forum at 2013/01/12. 11: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/01. 12: * 13: *---------------------------------------------------------------------- 14: */ 15: 16: /* 17: * @(#)liblock.c (libtk) 18: * 19: * Shared exclusive control lock in library 20: */ 21: 22: #include "libtk.h" 23: #include <sys/util.h> 24: #include <tk/util.h> 25: 26: LOCAL FastMLock LibLock; 27: 28: /* Set Object Name in .exinf for DEBUG */ 29: #define OBJNAME_LIBLOCK "lltk" /* multi-lock object name for liblock */ 30: 31: EXPORT ER _init_liblock( void ) 32: { 33: return CreateMLock(&LibLock, (UB*)OBJNAME_LIBLOCK); 34: } 35: 36: EXPORT ER _lib_locktmo( W lockno, W tmo, BOOL ignore_mintr ) 37: { 38: return MLockTmo(&LibLock, lockno, tmo); 39: } 40: 41: EXPORT ER _lib_lock( W lockno, BOOL ignore_mintr ) 42: { 43: return MLock(&LibLock, lockno); 44: } 45: 46: EXPORT void _lib_unlock( W lockno ) 47: { 48: MUnlock(&LibLock, lockno); 49: } 50: 51: EXPORT void _delete_liblock( void ) 52: { 53: DeleteMLock(&LibLock); 54: }