Go to the first, previous, next, last section, table of contents.


|maybeWriteStreamPacket

Function: |maybeWriteStreamPacket { [block] tag done stream -> [block] tag done }
file: job.t
package: muf
status: alpha

This function is exactly the same as |writeStreamPacket except that if the packet cannot be written to stream due to stream being too full, the code returns immediately without blocking or doing anything else other than popping the stream argument. (To discourage busy-waiting loops, no return value indicating success/failure is provided.)

This function is provided as one way of allowing messages to be sent to a group of listeners without risking having the sending job block indefinitely due to one blocked listener.

If stream is a proxy and muqnet:maybeWriteStreamPacket names a function, that function will be invoked: This is part of the inserver support for transparent networking.

In addition, if stream is a MOS object and muf:maybeWriteStreamPacket names a function, that function will be invoked: This is additional inserver support for transparent networking. The standard muf:maybeWriteStreamPacket function redirects the write to stream.io if it exists and is a message stream, else issues an error: This little hack allows requests to be written directly to a MOS object rather than to its io messageStream, saving the caller the choice between using an extra network roundTrip to fetch the recipient's io property, or passing it around in company with the recipient, at best a nuisance.

See section |writeStreamPacket.


Go to the first, previous, next, last section, table of contents.