- 論壇徽章:
- 2
|
原帖由 xie_minix 于 2006-5-25 18:11 發(fā)表
mirnshi:
我猜想,開發(fā)POLLING的團(tuán)隊(duì)有問題.他們對(duì)MUTEX的了解不夠,最起碼在5.3版本時(shí).
這是最要命的事情.
其次,寫代碼時(shí)沒經(jīng)過思考(請(qǐng)?jiān)徫疫@么說,他們也不容易),比如你看:
5.3版本
poll_idle(void)中
mtx ...
6.x中的代碼,不同呀。主版本3、5都不是很好,命短。
- /*
- * ether_poll is called from the idle loop.
- */
- void
- ether_poll(int count)
- {
- int i;
- NET_LOCK_GIANT();
- mtx_lock(&poll_mtx);
- if (count > poll_each_burst)
- count = poll_each_burst;
- for (i = 0 ; i < poll_handlers ; i++)
- pr[i].handler(pr[i].ifp, POLL_ONLY, count);
- mtx_unlock(&poll_mtx);
- NET_UNLOCK_GIANT();
- }
- static void
- poll_idle(void)
- {
- struct thread *td = curthread;
- struct rtprio rtp;
- rtp.prio = RTP_PRIO_MAX; /* lowest priority */
- rtp.type = RTP_PRIO_IDLE;
- mtx_lock_spin(&sched_lock);
- rtp_to_pri(&rtp, td->td_ksegrp);
- mtx_unlock_spin(&sched_lock);
- for (;;) {
- if (poll_in_idle_loop && poll_handlers > 0) {
- idlepoll_sleeping = 0;
- ether_poll(poll_each_burst);
- mtx_lock_spin(&sched_lock);
- mi_switch(SW_VOL, NULL);
- mtx_unlock_spin(&sched_lock);
- } else {
- idlepoll_sleeping = 1;
- tsleep(&idlepoll_sleeping, 0, "pollid", hz * 3);
- }
- }
- }
復(fù)制代碼
個(gè)人感覺,還是扔掉5.x吧,因?yàn)楫?dāng)初粗粗看了5.x,就覺得是個(gè)試驗(yàn)品,就沒有仔細(xì)看,一直在4.x上做。6.1出來了,應(yīng)該算是穩(wěn)定住了 |
|