What is "the queue"?
For a probably better answer, see the collaborative book \"Enough to be Dangerous\" on this site.
In PennMUSH, there are actually 4 kinds of queues that are important in softcode: the player queue, the object queue, the wait queue, and the semaphore queue. Usually people who talk about \"the queue\" mean the object queue.
- The player queue is a line of commands that have been typed by players directly to the MUSH from their connection. These get their own queue because the MUSH prefers to run commands from this queue when it can, so that it feels more responsive to players\' direct actions.
- The object queue is a line of commands to be run by objects (anything other than a player typing directly from their connection)
- The wait queue is a line of commands that are to be run at some time in the future (commands that have been enqueued using @wait =)
- The semaphore queue is a line of commands that are to be run at some time in the future and are controlled by a semaphore (commands that have been enqueued using @wait me/=)
Here\'s an example of the object queue in operation. Imagine that you\'re in a room with an object like this in it:
POP [#3]: @emit The toast pops!
START [#3]: $start: @emit %N starts the toaster; @tr me/POP
When you type \'start\', the object queues up this command set:
@emit %N starts the toaster; @tr me/POP
along with some information about who %N was at the time.
When this command set is at the front of the queue, the MUSH server executes it, \"Javelin starts the toaster\" is emitted, and the @trigger command is run, which puts the contents of the POP attribute onto the back of the queue.
In the meantime, of course, other things may be ahead of this and run from the queue, but eventually \"@emit The toast pops!\" is at the front of the queue, and is executed.
The @trigger command, @force command, and @switch/@select commands result in a new command-set being queued up. This is why code using these commands can feel slower -- you have to wait until the newly-queued command set is at the front of the queue before it runs. Of course, if speed isn\'t important, using the queue is a good thing -- it lets the MUSH server share its time between commands of all the objects, and reduces overall lag.
2001-Mar-29 6:33pm dunemush