# Blocking

## Description

A Device is Blocking if a `read` request never produces fewer characters than requested except at end-of-stream, and if a `write` request never consumes fewer characters than requested under any circumstances. All Devices currently provided with the Iostreams library are Blocking. Limited support for non-Blocking Devices has been provided as a foundation for future more comprehensive support of asynchronous and non-blocking i/o.

The Blocking concept does not apply to filters. Instead, filters are required to be blocking-preserving, which means that

- a `read` request never produces fewer characters than requested unless end-of-stream has been reached or unless a `read` request to a downsteam Source produces fewer characters than requested, and
- a `write` request never consumes fewer characters than requested unless a `write` request to a downsteam Sink consumes fewer characters than requested.

Unlike other Iostreams library concepts, Blocking is not associated with any category tag. In the future, a `non_blocking_tag` may be introduced.

## Refinement of

Device.

## Associated Types

Same as Device.

## Valid Expressions / Semantics

Valid expressions are the same as Device. The additional semantic requirements are described informally above.

© Copyright 2008 CodeRage, LLC
© Copyright 2004-2007 Jonathan Turkanis

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)