The HyperNews Linux KHG Discussion Pages

## found reason for select() problem

  Forum: Device Driver Basics
  Keywords: select add_timer() del_timer()
  Date: Wed, 13 Nov 1996 14:45:59 GMT
  From: <unknown>

    Hello again;

    Evidently not many folks read this -- no responses after
    4 months -- so I'll answer my own question :-)

    There were several problems with the original approach. These
    were all discovered through trial-and-error so I suppose
    there might still be other theoretical problems but at least
    now everthing seems to work.

    1) call del_timer(&pc39_tl) before starting a new one.
    2) always call select_wait (&pc39_wq, wait), not just when
       wait != 0.
    3) pc39_tl.expires is the jiffy to wake up on, not the number
       of elapsed jiffies as it says in the KHG. so, it should be:
       pc39_tl.expires = jiffies + PC39_SELTO;

    Hope this helps someone else someday. If this is getting
    too hard to follow, I'll be happy to send you the whole
    driver.

    Elwood Downey
    ecdowney@noao.edu