Re: System call and preemption...

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

 



> Is there some other/better way of handling this ?

Yes.

Your code should probably be more like:

func {
	if (some_condition)
		add yourself to a waitqueue and wait

	do whatever write does
}

You don't need the if/else because the process is waiting for the kernel
call to execute. the process will not continue until the kernel is done.
so, if you wait in your write call, your process will wait also.

I'm not terribly familiar with waitqueues, but I'm sure someone smater
than myself will enlighten you. Or you could read the faq's or lookup
waitqueues since that will probably get you where you want to be faster.

john

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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