Up: GEOS SDK TechDocs | Up | Prev: ThreadPSem() ... | Next: TocNameArrayFind() ...

TimerSleep()

void	TimerSleep(
        word	ticks);		/* number of ticks the thread should sleep */

This routine invokes a "sleep timer" that will put the calling thread to sleep for the given number of ticks. At the end of the time, the thread will continue executing with the next instruction.

Warnings: Do not use sleep timers as a substitute for semaphores for thread synchronization.

Include: timer.h

:

TimerStart()

TimerHandle TimerStart(
        TimerType		timerType,				/* type of timer to start */
        optr		destObject,				/* object to receive notification
						 * message when timer expires */
        word		ticks,				/* amount of time to run */
        Message		msg,				/* notification message */
        word		interval,				/* interval for continual timers */
        word		* id);				/* buffer for returned timer ID */

This routine starts a timer of any type. The timer will run for the specified number of ticks and then will send the given message to the destination object. The message is sent with the flags MF_FORCE_QUEUE, MF_CHECK_DUPLICATE and MF_REPLACE, so it will always be put in the recipient's queue and will always replace any duplicates already in the queue. Pass this routine the following:

timerType
A value of TimerType indicating the type of timer to start.
destObject
The optr of the object that will be sent the specified message when the time is up.
ticks
The number of ticks for the timer to run. (Sixty ticks equals one second.) For continual timers, this is the amount of time before the first timeout.
msg
The message to be sent to the destination object when time is up.
interval
For continual timers, the interval (number of ticks) at which to send out the message to the destination object. The timer will send the message once at the end of each interval. The first message will be sent ticks ticks after the timer is started. The second message will be sent interval ticks after that.
id
A pointer to a word in which the timer's ID will be returned. You will need this ID for TimerStop() .

This routine returns the handle of the timer as well as an ID pointed to by the id parameter. You will need the handle and the ID for TimerStop() .

Structures:

TimerType The TimerType enumerated type defines what type of timer should be initiated. It has the following values:

TIMER_ROUTINE_ONE_SHOT
Start a timer that will call a routine and then free itself when the time is expired. This type is supported in assembly but not in C.
TIMER_ROUTINE_CONTINUAL
Start a timer that will call a routine once per time interval (starting after ticks ticks) until TimerStop() is called.
TIMER_EVENT_ONE_SHOT
Start a timer that will send a message to a given object, then free itself when time is expired.
TIMER_EVENT_CONTINUAL
Start a timer that will send a message to a given object once per time interval (starting after ticks ticks) until TimerStop() is called.
TIMER_MS_ROUTINE_ONE_SHOT
Start a timer that has millisecond accuracy. For this timer, the number of ticks will actually be the number of milliseconds. The timer will call a specified routine and then free itself when time is expired. This type is supported in assembly but not in C.
TIMER_EVENT_REAL_TIME
Start a timer that will call a routine at some particular date and time. On devices that support such a timer, this event will wake a sleeping machine.

Include: timer.h

TimerStop()

Boolean	TimerStop(
        TimerHandle		th,			/* handle of timer to be stopped */
        word		id);			/* timer ID (returned by TimerStart() */

This routine stops and destroys a timer that had been started with TimerStart() . Pass it the timer handle and the ID as returned by that routine (the ID of a continual timer will always be zero).

The returned error flag will be true if the timer could not be found.

Warnings: If you call TimerStop() to stop a continual timer that sends its message across threads, there may be timer events left in the recipient's event queue. It is unsafe in this situation to assume that all timer events have been handled. To ensure the timer message has been handled, you can send the destination an "all-safe" message with the MF_FORCE_QUEUE flag.

Include: timer.h

TocDBLock()

void * TocDBLock(
        DBGroupAndItem 		thing);

Use this routine to lock a name array maintained by a PrefTocList object.

Include: config.goh

TocDBLockGetRef()

void * TocDBLockGetRef(
        DBGroupAndItem 		thing,
        optr		*refPtr);

This routine locks a name array maintained by a PrefTocList object, returning the item's pointer and optr.

Include: config.goh

TocFindCategory()

Boolean TocFindCategory(
        TocCategoryStruct 		*cat);

This routine searches a PrefTocList object's name lists for a given token.

Structures:

        typedef struct {
        	TokenChars 		TCS_tokenChars;
        	DBGroupAndItem 		TCS_files; 					/* file name array */
        	DBGroupAndItem 		TCS_devices; 					/* device name array--only if
        								 * TCF_EXTENDED_DEVICE_DRIVERS
        								 * is set. */
        } TocCategoryStruct;

Include: config.goh

TocGetFileHandle()

word TocGetFileHandle();

Use this routine to get the handle of the file used by PrefTocLists to store their name array data.

Include: config.goh

TocNameArrayAdd()

word TocNameArrayAdd(
        DBGroupAndItem 		array, 
        const char 		*nameToFind,
        const void 		*data);

Use this routine to add a name to a name array maintained by a PrefTocList object.

Include: config.h


Up: GEOS SDK TechDocs | Up | Prev: ThreadPSem() ... | Next: TocNameArrayFind() ...