git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2045 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-09-13 16:15:46 +00:00
parent 18c85aee17
commit 8468ddf520
2 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* drivers/pipe.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -99,6 +99,7 @@ static uint32 g_pipecreated = 0;
/****************************************************************************
* Name: pipe_allocate
****************************************************************************/
static inline int pipe_allocate(void)
{
int pipeno;
@ -119,6 +120,7 @@ static inline int pipe_allocate(void)
/****************************************************************************
* Name: pipe_free
****************************************************************************/
static inline void pipe_free(int pipeno)
{
int ret = sem_wait(&g_pipesem);
@ -132,6 +134,7 @@ static inline void pipe_free(int pipeno)
/****************************************************************************
* Name: pipe_close
****************************************************************************/
static int pipe_close(FAR struct file *filep)
{
struct inode *inode = filep->f_inode;
@ -179,6 +182,7 @@ static int pipe_close(FAR struct file *filep)
* appropriately.
*
****************************************************************************/
int pipe(int filedes[2])
{
struct pipe_dev_s *dev = NULL;

View File

@ -38,8 +38,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
@ -206,6 +206,7 @@ int pipecommon_open(FAR struct file *filep)
/* If this this is the first writer, then the read semaphore indicates the
* number of readers waiting for the first writer. Wake them all up.
*/
if (dev->d_nwriters == 1)
{
while (sem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0)