为什么在信号灯代码的down功能之前使用关键字sched? [英] Why is keyword sched used before down function of the semaphore code?

查看:69
本文介绍了为什么在信号灯代码的down功能之前使用关键字sched?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   `static noinline void __sched __down(struct semaphore *sem)`

在上面的函数中,为什么在信号量代码的__down函数之前使用__sched?

In the above function, why is __sched used before the __down function of the semaphore code?

推荐答案

__sched是宏而不是关键字,它向函数添加了一个属性,将其视为一些添加的元信息.

__sched is a macro and not keyword, adding an attribute to the function, think of it as some added meta-information.

<linux/sched.h>中定义:

/* Attach to any functions which should be ignored in wchan output. */
#define __sched         __attribute__((__section__(".sched.text")))

因此,将__sched宏添加到函数中会导致该函数的wchan信息被抑制.

So adding the __sched macro to a function results in supressing the wchan information for that function.

这篇关于为什么在信号灯代码的down功能之前使用关键字sched?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆