git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1494 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-02-14 01:56:40 +00:00
parent 364e4ac100
commit 8a66212a6d
2 changed files with 52 additions and 52 deletions

View File

@ -1,7 +1,7 @@
/************************************************************ /****************************************************************************
* sleep.c * sched/sleep.c
* *
* Copyright (C) 2007 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software * used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
@ -31,57 +31,57 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************/ ****************************************************************************/
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
/************************************************************ /****************************************************************************
* Definitions * Preprocessor Definitions
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Private Type Declarations * Private Type Definitions
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Global Variables * Global Variables
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Private Variables * Private Variables
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Public Functions * Public Functions
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Function: sleep * Function: sleep
* *
* Description: * Description:
* As typically declared in unistd.h. sleep() is a simple * As typically declared in unistd.h. sleep() is a simple application of
* application of sigtimedwait. * sigtimedwait.
* *
* Parameters: * Parameters:
* seconds * seconds
* *
* Returned Value: * Returned Value:
* Zero if the requested time has elapsed, or the number * Zero if the requested time has elapsed, or the number of seconds left
* of seconds left to sleep. * to sleep.
* *
* Assumptions: * Assumptions:
* *
************************************************************/ ****************************************************************************/
unsigned int sleep(unsigned int seconds) unsigned int sleep(unsigned int seconds)
{ {
@ -95,7 +95,7 @@ unsigned int sleep(unsigned int seconds)
ts.tv_sec = seconds; ts.tv_sec = seconds;
ts.tv_nsec = 0; ts.tv_nsec = 0;
(void)sigtimedwait(&set, &value, &ts); (void)sigtimedwait(&set, &value, &ts);
} }
return 0; return 0;
} }

View File

@ -1,7 +1,7 @@
/************************************************************ /****************************************************************************
* usleep.c * sched/usleep.c
* *
* Copyright (C) 2007 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be * 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software * used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
@ -31,46 +31,46 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************/ ****************************************************************************/
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
/************************************************************ /****************************************************************************
* Definitions * Definitions
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Private Type Declarations * Private Type Declarations
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Global Variables * Global Variables
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Private Variables * Private Variables
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Public Functions * Public Functions
************************************************************/ ****************************************************************************/
/************************************************************ /****************************************************************************
* Function: usleep * Function: usleep
* *
* Description: * Description:
* BSD version as typically declared in unistd.h. suleep() * BSD version as typically declared in unistd.h. usleep() is a simple
* is a simple application of sigtimedwait. * application of sigtimedwait.
* *
* Parameters: * Parameters:
* seconds * seconds
@ -80,7 +80,7 @@
* *
* Assumptions: * Assumptions:
* *
************************************************************/ ****************************************************************************/
void usleep(unsigned long usec) void usleep(unsigned long usec)
{ {
@ -94,5 +94,5 @@ void usleep(unsigned long usec)
ts.tv_sec = usec / 1000000; ts.tv_sec = usec / 1000000;
ts.tv_nsec = (usec % 1000000) * 1000; ts.tv_nsec = (usec % 1000000) * 1000;
(void)sigtimedwait(&set, &value, &ts); (void)sigtimedwait(&set, &value, &ts);
} }
} }