關于“ 在Java中,哪個線程調用Thread.sleep,就會休眠哪個線程!Q:在A線程怎么休眠B線程?
”
的推薦:
-
在linux中調度多個微線程
您連續三次調度同一個微線程,但只有在微線程已經運行(或當前正在運行)的情況下,才能再次調度該微線程。
事實上,
tasklet_schedule()
會檢查tasklet->state
,并且只有在尚未調度時才對其進行調度:static inline void tasklet_schedule(struct tasklet_struct *t) { if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) __tasklet_schedule(t); }
如果要連續運行tasklet 3次,可以從其內部重新安排它:
struct my_tasklet_data { unsigned n_runs; u64 jiffies; } void fill_buf(unsigned long data) { struct my_tasklet_data *td = (struct my_tasklet_data *)data; // Do what you need using td->jiffies ... // Reschedule for running if needed if (++td->n_runs < 3) { td->jiffies = get_jiffies_64(); tasklet_schedule(fill_buf); } }
/* Somewhere else in your code */ struct my_tasklet_data data = { .jiffies = get_jiffies_64(), .n_runs = 0 }; fill_buf->data = (unsigned long)&data; tasklet_schedule(fill_buf);
這里已經是底線啦~
1
html2canvas這個插件怎么用啊,每次截圖都是不一樣的結果 please
2
靜態統計 動態統計
3
excel先按字母排序再按數字排序
4
python對分組進行排序
5
mybatis-plus 多數據源怎么設置方言?
6
為什么最下部報錯?為什么第八行sort(a)用不了下面的方法?求解
7
使用BootstrapTable插件,如何在編輯后,獲取當前編輯input的值以及同一行的其他字段的值?
8
python計算兩個日期的年齡
9
系統更新一直在加載
10