question on select

question on select

Post by T. Jah » Thu, 25 Mar 1999 04:00:00



Hello world!

I want to make a short sleep (about 10us) in a module.

Is there a possibility to use select? If not, what else can I do?

bye & cus,
        Tobias Jahn

_________________________________________
Linux - Where do you want to go tomorrow?

 
 
 

question on select

Post by Martin Recktenwal » Fri, 26 Mar 1999 04:00:00



> I want to make a short sleep (about 10us) in a module.

> Is there a possibility to use select? If not, what else can I do?

Use a kernel timer. Have a look at the usage of init_timer() and
add_timer() in the driver sources. Or read the appropriate chapter in
Rubinis "Writing Linux Device Drivers" book.

Note that this will only work if you have a process that you can put
the sleep, not within an interrupt or bottom half; but you dont want
to wait there anyway.

    Martin.
--
Sign the petition against spam:
                    http://www.politik-digital.de/spam/

 
 
 

question on select

Post by Vincen » Fri, 26 Mar 1999 04:00:00




> > I want to make a short sleep (about 10us) in a module.

> > Is there a possibility to use select? If not, what else can I do?

> Use a kernel timer. Have a look at the usage of init_timer() and
> add_timer() in the driver sources. Or read the appropriate chapter in
> Rubinis "Writing Linux Device Drivers" book.

> Note that this will only work if you have a process that you can put
> the sleep, not within an interrupt or bottom half; but you dont want
> to wait there anyway.

>     Martin.
> --
> Sign the petition against spam:
>                     http://www.politik-digital.de/spam/

You can use the udelay function: udelay(unsigned long usec);    //usec
means microseconds

You can use this function for a maximum 1000 microseconds (1
millisecond).
This timer is  busy-waiting function and other tasks cant't be run while
this lapse.


 
 
 

1. if change date during select ( ), select is hang

[problem]

In my code like following, using select() and an application as linked
pthread lib.
If I change date, application hanging.

(sample code)
#include <stdio.h>
#include <sys/time.h>

int
main()
{
    struct timeval timeout;
    int cnt;

    for(cnt=0;;cnt++) {
#if 1
        timeout.tv_sec  = 5;
        timeout.tv_usec = 0;
        select(0,0,0,0,&timeout);
#else
        sleep(5);
#endif
        printf("[%d] Wakeup \n",cnt);
    }

(compile & link)
cc -o test_sleep test_sleep.c -lpthread

(If I change date at another terminal like "date 0101010102", sample code is
blocked)

I think this problem can solve with some kernel patch.

Somebody help me~ T_T

2. LS-120 and the Linux Kernel

3. How does select() function "select"?

4. Oracle on SUN --> Oracle on DEC Aplha + Digital Unix ?

5. select field n to last? select last field?

6. how to get the ethernet address of a network interface without root permissions?

7. Does select() return if the FD changed before select() was called?

8. vcd, .dat files and isofs problem

9. select() and ignore work, reissue select.

10. Question using UNIX select() call on an HP

11. question: select()

12. Select and FD question

13. select() question...