/* Returns: TRUE if pending was previously unset and is now set.  */
gboolean g_input_stream_set_pending(GInputStream *stream, GError **error)
/* Returns: TRUE if pending was previously unset and is now set.  */
gboolean g_input_stream_set_pending(GInputStream *stream, GError **error)
{
  g_return_val_if_fail (G_IS_INPUT_STREAM (stream), FALSE);
  if (stream->priv->closed)
    {
      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED,
                           _("Stream is already closed"));
      return FALSE;
    }
  if (stream->priv->pending)
    {
      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_PENDING,
		 _("Stream has outstanding operation"));
      return FALSE;
    }
  stream->priv->pending = TRUE;
  return TRUE;
}