Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : TT.H

 
Output of file : TT.H contained in archive : PCCAPP.ZIP
/*
* This file is part of the Choices Operating System
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992
* The University of Illinois Board of Trustees.
* All Rights Reserved.
*
* Author: Gary M. Johnston ([email protected])
* Contributing Author: Douglas E. Leyens ([email protected])
* Contributing Author: David Dykstra ([email protected])
* Contributing Author: Lee Lup Yuen ([email protected])
* Project Manager and Principal Investigator: Roy Campbell ([email protected])
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for educational, research, and non-profit purposes
* is hereby granted provided that the above copyright notice, the
* original authors names, and this permission notice appear in all such
* copies and supporting documentation; that no charge be made for such
* copies; and that the name of the University of Illinois not be used
* in advertising or publicity pertaining to distribution of the
* software without specific prior written permission. Any entity
* desiring permission to incorporate this software into commercial
* products should contact the Computing Research Laboratory, Department
* of Computer Science, University of Illinois, 1304 W. Springfield
* Avenue, Urbana, IL 61801. The University of Illinois makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/*
* TimeoutTimer.h - global Timeout timer.
*/

#ifndef TimeoutTimer_h
#define TimeoutTimer_h
#ifdef __GNUG__
#pragma once
#pragma interface
#endif

/* #define TIMEOUTTIMERDEBUG */

#ifdef TIMEOUTTIMERDEBUG
#define STATISTICS
#endif

#define ONELOCK

#include "Timer.h" /* parent class */

#include "LOCK.h" /* to get the LOCK define */
/* class LOCK; */

#include "ClassStar.h"
#include "SemaphoreStar.h"

class Semaphore; // forward reference...
class Statistics;

static const int WHEELHASHPOWER = 10;
static const int WHEELHASHSIZE = 1024; /* WHEELHASHSIZE = 2 ^ WHEELHASHPOWER */
static const unsigned int WHEELHASHMASK = WHEELHASHSIZE - 1;


extern ClassStar TimeoutTimerClass;
class TimeoutTimer : public Timer {
/* A TimeoutTimer is a clock that counts backwards to 0 after being set by the
* programmer. While the clock is ticking, the TimeoutTimer may be stopped by
* the programmer, or the programmer may tell the TimeoutTimer to block the
* current process until the timer expires.
*/
protected:
/*
* This is the per-instance data and protected functions
*/
SemaphoreStar timeoutSemaphore; /* semaphore to V when expires */
SemaphoreStar raceSemaphore; /* semaphore for stop/expire races */
char running; /* timer running flag */
char expiring; /* timer expiring flag */
char waiting; /* timer waiting to be stopped flag */
int tableIndex; /* index into timeout table */
unsigned int tickCount; /* upper bits of count left in timer */
unsigned int expireTick; /* tickTime of expiration */
TimeoutTimer *prev; /* linked list backward pointer */
TimeoutTimer *next; /* linked list forward pointer */

void waitExpire();

/*
* Now for the class data and functions
*/
static TimeoutTimer *table[WHEELHASHSIZE];
static unsigned int tickTime;
static int index();
#ifdef ONELOCK
static LOCK *lock;
#else
static LOCK *lock[WHEELHASHSIZE+1];
#endif
static void acquireLock(int);
static void releaseLock(int);

static TimeoutTimer ** bucket(int indx);
static int hashIndex( unsigned int index );
static int hashRemainder( unsigned int index );
static int hashValue( unsigned int index );

static unsigned int timeResidual( TimeoutTimer * ptr );

static Statistics *stat;

#ifdef TIMEOUTTIMERDEBUG
static void check(unsigned int saveTime, int indx);
static void dumpBucket();
public:
static void dump();
#endif

public:

static void initialize();

static int perTickBookKeeping();
static void expiryProcessing();

/*
* Now back to regular public functions
*/

/* Method TimeoutTimer: Create a TimeoutTimer. The timer will not
* tick until we call start().
*/
proxiable TimeoutTimer();

/* Method ~TimeoutTimer: Stop the TimeoutTimer and destroy it. */
proxiable ~TimeoutTimer();

/* Method start: Starts the timer and returns actual number of
* microseconds set, possibly rounded up to the granularity of the
* hardware timer.
*/
proxiable unsigned int start( unsigned int microseconds );

/* Method stop: Returns the residual number of microseconds after
* stopping.
*/
proxiable unsigned int stop();

/* Method residual: Returns the remaining number of microseconds. */
proxiable unsigned int residual();

/* Method await: Returns when the timer expires. */
proxiable void await();

/* Method classOf: Return the class of this object. */
Class *classOf();
};

#endif /* TimeoutTimer_h */
/*
* This file is part of the Choices Operating System
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992
* The University of Illinois Board of Trustees.
* All Rights Reserved.
*
* Author: Systems Research Group ([email protected])
* Project Manager and Principal Investigator: Roy Campbell ([email protected])
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for educational, research, and non-profit purposes
* is hereby granted provided that the above copyright notice, the
* original authors names, and this permission notice appear in all such
* copies and supporting documentation; that no charge be made for such
* copies; and that the name of the University of Illinois not be used
* in advertising or publicity pertaining to distribution of the
* software without specific prior written permission. Any entity
* desiring permission to incorporate this software into commercial
* products should contact the Computing Research Laboratory, Department
* of Computer Science, University of Illinois, 1304 W. Springfield
* Avenue, Urbana, IL 61801. The University of Illinois makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/* This file was generated by Proxify++ version 0.1 */

#ifndef TimeoutTimer_h
#define TimeoutTimer_h
#ifdef __GNUG__
#pragma once
#pragma interface
#endif
#include "Timer.h"
#include "LOCK.h"
#include "ClassStar.h"
#include "SemaphoreStar.h"
class Semaphore;
class Statistics;
static const int WHEELHASHPOWER = 10;
static const int WHEELHASHSIZE = 1024;
static const unsigned int WHEELHASHMASK = WHEELHASHSIZE - 1;
extern ClassStar TimeoutTimerClass;
class TimeoutTimer : public Timer {
public:
proxiable TimeoutTimer();
proxiable virtual ~TimeoutTimer();
proxiable virtual unsigned int start(unsigned int microseconds);
proxiable virtual unsigned int stop();
proxiable virtual unsigned int residual();
proxiable virtual void await();
};
#include "VersionInstaller.h"
REQUIREDVERSION( TimeoutTimer );
#endif TimeoutTimer_h


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : TT.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/