博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux Kernel 互斥量
阅读量:4153 次
发布时间:2019-05-25

本文共 1694 字,大约阅读时间需要 5 分钟。

/*
 * Simple, straightforward mutexes with strict semantics: * * - only one task can hold the mutex at a time * - only the owner can unlock the mutex * - multiple unlocks are not permitted * - recursive locking is not permitted * - a mutex object must be initialized via the API * - a mutex object must not be initialized via memset or copying * - task may not exit with mutex held * - memory areas where held locks reside must not be freed * - held mutexes must not be reinitialized * - mutexes may not be used in hardware or software interrupt *   contexts such as tasklets and timers * * These semantics are fully enforced when DEBUG_MUTEXES is * enabled. Furthermore, besides enforcing the above rules, the mutex * debugging code also implements a number of additional features * that make lock debugging easier and faster: * * - uses symbolic names of mutexes, whenever they are printed in debug output * - point-of-acquire tracking, symbolic lookup of function names * - list of all locks held in the system, printout of them * - owner tracking * - detects self-recursing locks and prints out all relevant info * - detects multi-task circular deadlocks and prints out all affected *   locks and tasks (and only those tasks) */struct mutex {	/* 1: unlocked, 0: locked, negative: locked, possible waiters */	atomic_t		count;	spinlock_t		wait_lock;	struct list_head	wait_list;#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)	struct task_struct	*owner;#endif#ifdef CONFIG_MUTEX_SPIN_ON_OWNER	struct optimistic_spin_queue osq; /* Spinner MCS lock */#endif#ifdef CONFIG_DEBUG_MUTEXES	void			*magic;#endif#ifdef CONFIG_DEBUG_LOCK_ALLOC	struct lockdep_map	dep_map;#endif};
 

转载地址:http://rgqti.baihongyu.com/

你可能感兴趣的文章
MySQL 存储过程或者函数中传参数实现where id in(1,2,3,...)IN条件拼接
查看>>
java反编译
查看>>
Class.forName( )你搞懂了吗?——转
查看>>
jarFile
查看>>
EJB与JAVA BEAN_J2EE的异步消息机制
查看>>
数学等于号是=那三个横杠是什么符
查看>>
HTTP协议详解
查看>>
java多线程中的join方法详解
查看>>
ECLIPSE远程调试出现如下问题 ECLIPSE中调试代码提示找不到源
查看>>
java abstract修饰符
查看>>
数组分为两部分,使得其和相差最小
查看>>
有趣的排序——百度2017春招
查看>>
二叉树的最近公共祖先LCA
查看>>
数组中累加和为定值K的最长子数组长度
查看>>
素数对--腾讯2017校招编程
查看>>
JAVA集合--ArrayList实现原理
查看>>
synchronized与Lock
查看>>
数据库索引
查看>>
实现包含min,max,push,pop函数的栈
查看>>
实验2-6 字符型数据的输入输出
查看>>