Re: Generic I/O

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On 12:15 Mon 14 Nov     , Kai Meyer wrote:
...

> My 
> caller function has an atomic_t value that I set equal to the number of 
> bios I want to submit. Then I pass a pointer to that atomic_t around to 
> each of the bios which decrement it in the endio function for that bio.
> 
> Then the caller does this:
> while(atomic_read(numbios) > 0)
>          msleep(1);
> 
> I'm finding the msleep(1) is a really really really long time, 
> relatively. It seems to work ok if I just have an empty loop, but it 
> also seems to me like I'm re-inventing a wheel here.
...

You might want to take a look at wait queues (the kernel equivalent to pthread
"condidions"). Basically you instead of calling msleep(), you call
wait_event(). In the function which decrements numbios, you check whether it
is 0 and if so call wake_up().

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux