Frontier Tutorials / Working With Threads / Frontier's Thread Verbs

Frontier's Thread Verbs

We've already seen Frontier's semaphore verbs. Frontier also provides a variety of thread verbs. These verbs are fully documented on Userland's "docserver website". Here's a brief introduction to them.


thread.easyCall is the verb to call when you want to start up a thread and not wait for it to complete. We used this verb in the tutorial example to start up the query threads.

Evaluate a Script in a Separate Thread

thread.evaluate works just like the evaluate verb, but does its evaluation in a new thread. It starts a new thread to evaluate the UserTalk script passed to it, then immediately returns the thread ID as its function result, rather than waiting for the evaluation to complete. To find out whether the evaluation is complete, you can call thread.exists with the thread ID returned by this function.

thread.evaluateTo is just like thread.evaluate, but also takes an address in the ODB in which you want it to store its result.

Thread Management

thread.exists is obvious: give it a thread ID and it will tell you if the thread exists.

thread.getCount returns the number of threads currently in existence.

thread.getCurrentID returns the thread ID of the process from which it is called.

thread.getNthID returns the thread ID of the nth thread in the thread list.

thread.isSleeping returns whether a specified thread is sleeping, or, conversely, whether it is active.

thread.kill terminates processing within a specified thread and deletes the thread.

thread.sleep puts the current thread to sleep permanently (until a different thread wakes it up by calling thread.wake).

thread.sleepFor puts the current thread to sleep for a specified length of time.

thread.wake forces a specified thread to become active.

Applicable Clock Verbs

clock.waitSeconds puts the current thread to sleep for a specified number of seconds.

clock.waitSixtieths puts the current thread to sleep for a specified number of ticks.

Here's a bonus utility script.

Tutorial Contents
Working With Threads
What Are Threads?
Semaphores--Traffic Control for Threads
How to Be Thread-Friendly
Rules of Thread Safety
An Example
Frontier's Thread Verbs
Thread Utilities
Glossary of Terms
About the Author