diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-12-31 18:23:16 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-12-31 18:23:16 +0000 |
commit | 0d227c4e86fd246a7da6e9edb97e6bef77779729 (patch) | |
tree | a8bb77358150faa0d0372965e313bd2ff914d54c /lib/libpthread/uthread/pthread_private.h | |
parent | c46895d8d7573ae0e7da97af7986b5630e355e97 (diff) |
More changes from FreeBSD, including:
o Only poll file descriptors when needed.
o Change the way timing is achieved, counting scheduling ticks
instead of calculating the elapsed time via gettimeofday().
o Prevent an overflow when polling.
o Use curthread instead of _thread_run.
o Remove extra spaces; indent.
Diffstat (limited to 'lib/libpthread/uthread/pthread_private.h')
-rw-r--r-- | lib/libpthread/uthread/pthread_private.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h index af234ac6c7d..8c76cef2ce9 100644 --- a/lib/libpthread/uthread/pthread_private.h +++ b/lib/libpthread/uthread/pthread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_private.h,v 1.32 2001/12/19 02:02:52 fgsch Exp $ */ +/* $OpenBSD: pthread_private.h,v 1.33 2001/12/31 18:23:15 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -255,14 +255,14 @@ struct pthread_mutex { }; /* - * Flags for mutexes. + * Flags for mutexes. */ #define MUTEX_FLAGS_PRIVATE 0x01 #define MUTEX_FLAGS_INITED 0x02 #define MUTEX_FLAGS_BUSY 0x04 /* - * Static mutex initialization values. + * Static mutex initialization values. */ #define PTHREAD_MUTEX_STATIC_INITIALIZER \ { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, TAILQ_INITIALIZER, \ @@ -314,7 +314,7 @@ struct pthread_cond_attr { #define COND_FLAGS_BUSY 0x04 /* - * Static cond initialization values. + * Static cond initialization values. */ #define PTHREAD_COND_STATIC_INITIALIZER \ { COND_TYPE_FAST, TAILQ_INITIALIZER, NULL, NULL, \ @@ -412,14 +412,15 @@ enum pthread_susp { #define PTHREAD_BASE_PRIORITY(prio) ((prio) & PTHREAD_MAX_PRIORITY) /* - * Clock resolution in nanoseconds. + * Clock resolution in microseconds. */ -#define CLOCK_RES_NSEC 10000000 +#define CLOCK_RES_USEC 10000 +#define CLOCK_RES_USEC_MIN 1000 /* * Time slice period in microseconds. */ -#define TIMESLICE_USEC 100000 +#define TIMESLICE_USEC 20000 /* * Define a thread-safe macro to get the current time of day @@ -627,11 +628,11 @@ struct pthread { /* Thread state: */ enum pthread_state state; - /* Time that this thread was last made active. */ - struct timeval last_active; + /* Scheduling clock when this thread was last made active. */ + long last_active; - /* Time that this thread was last made inactive. */ - struct timeval last_inactive; + /* Scheduling clock when this thread was last made inactive. */ + long last_inactive; /* * Number of microseconds accumulated by this thread when @@ -650,7 +651,7 @@ struct pthread { /* * Error variable used instead of errno. The function __error() - * returns a pointer to this. + * returns a pointer to this. */ int error; @@ -959,9 +960,9 @@ SCLASS int _thread_dtablesize /* Descriptor table size. */ ; #endif -SCLASS int _clock_res_nsec /* Clock resolution in nsec. */ +SCLASS int _clock_res_usec /* Clock resolution in usec. */ #ifdef GLOBAL_PTHREAD_PRIVATE -= CLOCK_RES_NSEC; += CLOCK_RES_USEC; #else ; #endif |