[英语单词] drain

这个词在Linux 内核里经常出现,而且和flush的关联性很高。

n. 排水沟, 消耗, 排水
vt. 排出, 喝光, 耗尽
vi. 排水, 流干
【化】 排放口
【医】 引流管, 引流物, 排水沟, 泄水, 排水, 引流, 导液
相关词组:
down the drain
<— 牛津现代英汉双解词典 —>
/dreɪn; dren/ n 1 pipe or channel that carries away sewage or other unwanted liquid 下水管; 下水道; 阴沟: We had to call a plumber to unblock the drains. 我们得叫管工来通一通下水道. =>illus at App 1 见附录1之插图, page vi. 2 (US) = plug-hole. 3 (idm 习语) (go) down the `drain (infml 口) be wasted or spoilt 被浪费; 白费: A single mistake and all that time and money would go down the drain. 只要发生一个错误, 全部的时间和金钱就将尽付东流. a drain on sb/sth anything that continuously uses up sb’s strength, time, money, etc 消耗精力、时间、金钱等的事物: Military spending is a huge drain on the country’s resources. 军费开支是国家资源的一大消耗.

/dreɪn; dren/ v 1 [I, Ipr, Ip, Tn, Tn.pr, Tn.p] ~ (sth) (from sth); ~ (sth) (away/off) (cause liquid to) flow away (使液体)流走: All the blood drained from his face, eg on hearing bad news. 他面无人色(如听到坏消息)The mechanic drained all the oil from the engine. 机械工将发动机中的油全部放走. 2 [Tn, Cn.a] empty (a glass, etc) 喝光, 喝乾(杯…中的饮料): drain one’s glass dry 把杯中饮料喝光. 3 [I, Tn] (cause sth to) become dry as liquid flows away (使某物)流乾, 滴乾: Leave the dishes to drain. 让碟子控乾. Land must be well drained for some crops. 某些作物要求土地有良好的排水性能. 4 [Tn, Tn.pr] ~ sb/sth (of sth) (fig 比喻) make sb/sth weaker, poorer, etc by gradually using up his/its strength, money, etc 消耗或耗尽某人[某物]的精力、金钱等: feel drained of energy 觉得精疲力竭 * a country drained of its manpower 耗尽人力的国家.

就是要处理掉的含义,和flush的意思差不多。flush也是要将不要的东西刷掉。flush:https://mzhan017.blog.csdn.net/article/details/127525305

比如这里,在workqueue这个结构体里,number-drianers,就代表有几个清除/耗尽器。

struct workqueue_struct {
    
    
	int			nr_drainers;	/* WQ: drain in progress */

将workqueue,耗尽。destroy_workqueue调用下面这个函数,也就是在销毁之前让其耗尽内容。

 * drain_workqueue - drain a workqueue
 * @wq: workqueue to drain

		raw_spin_lock_irq(&pwq->pool->lock);
		drained = !pwq->nr_active && list_empty(&pwq->delayed_works);
		raw_spin_unlock_irq(&pwq->pool->lock);

		if (drained)
			continue;

		if (++flush_cnt == 10 ||
		    (flush_cnt % 100 == 0 && flush_cnt <= 1000))
			pr_warn("workqueue %s: drain_workqueue() isn't complete after %u tries\n",
				wq->name, flush_cnt);

上面这一段里用了drain,还有flush。

猜你喜欢

转载自blog.csdn.net/qq_36428903/article/details/131877747
今日推荐