lkml.org 
[lkml]   [1999]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject2. I need to do block I/O, both synchronously and asynchronously.
I sugggest (1) the plethora of drivers in the source, and (2)
Alessando Rubini's Linux Device Drivers, published by ORA.

> 1. What is the correct way to do a generic thread yield?

Assuming a __kernel__ thread yield, schedule() is correct.

void semTake(SEM_ID psem, int timeout)
{
// Note no timeout provision....
int i=0;

if (verbosity > 15) printk(" semTake %x\n", *psem);

while (*psem == _T_SEM_EMPTY )
{
schedule(); // note: using sleep_on is a better
possibility...
.....

> 2. I need to do block I/O, both synchronously and asynchronously.

static struct wait_queue *data_wait_queue = NULL;

interruptible_sleep_on(&data_wait_queue);
wake_up_interruptible(&data_wait_queue);

> 3. What is the right way to determine the number of blocks...

I've only done network drivers. I stay away from block thingys.

-Richard

--
Richard Dynes
rdynes@varcom.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.373 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site