[Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.119,2.120

Martin v. L?wis loewis@users.sourceforge.net
Wed, 16 Jan 2002 03:04:08 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv28113

Modified Files:
	timemodule.c 
Log Message:
Patch #504225: add plan9 ifdef to timemodule floatsleep.


Index: timemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v
retrieving revision 2.119
retrieving revision 2.120
diff -C2 -d -r2.119 -r2.120
*** timemodule.c	2002/01/12 11:05:09	2.119
--- timemodule.c	2002/01/16 11:04:06	2.120
***************
*** 779,784 ****
  	}
  	Py_END_ALLOW_THREADS
! #else /* !HAVE_SELECT || __BEOS__ */
! #ifdef macintosh
  #define MacTicks	(* (long *)0x16A)
  	long deadline;
--- 779,783 ----
  	}
  	Py_END_ALLOW_THREADS
! #elif defined(macintosh)
  #define MacTicks	(* (long *)0x16A)
  	long deadline;
***************
*** 789,800 ****
  			return -1;
  	}
! #else /* !macintosh */
! #if defined(__WATCOMC__) && !defined(__QNX__)
  	/* XXX Can't interrupt this sleep */
  	Py_BEGIN_ALLOW_THREADS
  	delay((int)(secs * 1000 + 0.5));  /* delay() uses milliseconds */
  	Py_END_ALLOW_THREADS
! #else /* !__WATCOMC__ || __QNX__ */
! #ifdef MSDOS
  	struct timeb t1, t2;
  	double frac;
--- 788,797 ----
  			return -1;
  	}
! #elif defined(__WATCOMC__) && !defined(__QNX__)
  	/* XXX Can't interrupt this sleep */
  	Py_BEGIN_ALLOW_THREADS
  	delay((int)(secs * 1000 + 0.5));  /* delay() uses milliseconds */
  	Py_END_ALLOW_THREADS
! #elif defined(MSDOS)
  	struct timeb t1, t2;
  	double frac;
***************
*** 825,830 ****
  			break;
  	}
! #else /* !MSDOS */
! #ifdef MS_WIN32
  	{
  		double millisecs = secs * 1000.0;
--- 822,826 ----
  			break;
  	}
! #elif defined(MS_WIN32)
  	{
  		double millisecs = secs * 1000.0;
***************
*** 838,843 ****
  		Py_END_ALLOW_THREADS
  	}
! #else /* !MS_WIN32 */
! #ifdef PYOS_OS2
  	/* This Sleep *IS* Interruptable by Exceptions */
  	Py_BEGIN_ALLOW_THREADS
--- 834,838 ----
  		Py_END_ALLOW_THREADS
  	}
! #elif defined(PYOS_OS2)
  	/* This Sleep *IS* Interruptable by Exceptions */
  	Py_BEGIN_ALLOW_THREADS
***************
*** 848,853 ****
  	}
  	Py_END_ALLOW_THREADS
! #else /* !PYOS_OS2 */
! #ifdef __BEOS__
  	/* This sleep *CAN BE* interrupted. */
  	{
--- 843,847 ----
  	}
  	Py_END_ALLOW_THREADS
! #elif defined(__BEOS__)
  	/* This sleep *CAN BE* interrupted. */
  	{
***************
*** 865,870 ****
  		Py_END_ALLOW_THREADS
  	}
! #else /* !__BEOS__ */
! #ifdef RISCOS
  	if (secs <= 0.0)
  		return 0;
--- 859,863 ----
  		Py_END_ALLOW_THREADS
  	}
! #elif defined(RISCOS)
  	if (secs <= 0.0)
  		return 0;
***************
*** 874,890 ****
  		return -1;
  	Py_END_ALLOW_THREADS
! #else /* !RISCOS */
  	/* XXX Can't interrupt this sleep */
  	Py_BEGIN_ALLOW_THREADS
  	sleep((int)secs);
  	Py_END_ALLOW_THREADS
! #endif /* !RISCOS */
! #endif /* !__BEOS__ */
! #endif /* !PYOS_OS2 */
! #endif /* !MS_WIN32 */
! #endif /* !MSDOS */
! #endif /* !__WATCOMC__ || __QNX__ */
! #endif /* !macintosh */
! #endif /* !HAVE_SELECT */
  
  	return 0;
--- 867,892 ----
  		return -1;
  	Py_END_ALLOW_THREADS
! #elif defined(PLAN9)
! 	{
! 		double millisecs = secs * 1000.0;
! 		if (millisecs > (double)LONG_MAX) {
! 			PyErr_SetString(PyExc_OverflowError, "sleep length is too large");
! 			return -1;
! 		}
! 		/* This sleep *CAN BE* interrupted. */
! 		Py_BEGIN_ALLOW_THREADS
! 		if(sleep((long)millisecs) < 0){
! 			Py_BLOCK_THREADS
! 			PyErr_SetFromErrno(PyExc_IOError);
! 			return -1;
! 		}
! 		Py_END_ALLOW_THREADS
! 	}
! #else
  	/* XXX Can't interrupt this sleep */
  	Py_BEGIN_ALLOW_THREADS
  	sleep((int)secs);
  	Py_END_ALLOW_THREADS
! #endif
  
  	return 0;