Skip to main content.
Navigation:
DENX
>
Training2
>
LddNonBlockingIo
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
Training2
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
Training2 Home
Changes
Index
Search
Go
List of pages in Training2
Search
%SECTION0{name=LddNonBlockingIo}% Non-Blocking IO * normal (blocking) behavour * =read=: process blocks if no data is available and may return less than requested * =write=: process blocks if output buffer is full. =write= returns once free space becomes available in output buffer. Partial write possible. * non-blocking behaviour * open with =O_NONBLOCK= * both read and write return =-EAGAIN= * allows polling device ---++API: waitqueues *type:* <verbatim> wait_queue_head_t </verbatim> _linux/wait.h_ *Declaration:* <verbatim> /* compile time */ DECLARE_WAIT_QUEUE_HEAD(name); /* run time */ wait_queue_head_t q; init_waitqueue_head(&q); </verbatim> *Sleeping:* <verbatim> wait_event(queue, condition) wait_event_interruptible(queue, condition) wait_event_timeout(queue, condition, timeout) wait_event_interruptible_timeout(queue, condition, timeout) </verbatim> *waking up sleeping processes:* <verbatim> void wake_up(wait_queue_head_t *queue); void wake_up_interruptible(wait_queue_head_t *queue); </verbatim> *specialities:* * exclusive waits: wake only one process on queue (avoids _thundering herd_). =wake_up= wakes up all non-exclusive waiters and one exclusive waiter. * =wake_up_nr, wake_up_interruptible_nr=: wake up to X exclusive waiters * =wake_up_interruptible_sync=: avoid (possible) immediate rescheduling so that =wake_up= will return. *deprecated:* <verbatim> void sleep_on(wait_queue_head_t *q); void interruptible_sleep_on(wait_queue_head_t *q); </verbatim>
5.3.5. The read and write system calls
1. Denx Training Topics
5.3.7. =poll= and =select=
Prev
Home
Next