Re: Suggestion for Linux 2.3

Ingo Molnar (mingo@pc5829.hil.siemens.at)
Tue, 7 Jan 1997 14:59:35 +0100 (MET)


On Tue, 7 Jan 1997, William Burrow wrote:

> In different note, someone pointed out to me that in some cases an
> application is required to know when a disk write occurs. Would it be
> possible to have some mechanism in the buffer/cache system to send a
> signal to an app when buffers have bee flushed that requested this signal?

you can do this with threads, in user-space, using LinuxThreads:

------------------------------------------------------>
pthread_cond_init(cond1);
pthread_create(newthread,do_controlled_async_writeout);

<do stuff>

pthread_cond_wait(cond1);

...

do_controlled_async_writeout()
{
do_a_blocking_write();
pthread_cond_signal(cond1);
pthread_exit(this);
}
<------------------------------------------------------

or whatever synronization method you want, this conditional variable is
just one example.

this solution is fast, cheap and robust.

-- mingo