A methodology for using multiple execution threads to regulate message
traffic is presented. An application thread spawns a limiter thread, and
each have access in shared memory to a message count that reflects a
number of messages that are transmitted by the application thread within
a regulated time period. The limiter thread cycles by entering a sleep
state for the regulated time period, resetting the message count upon
awakening, and then reentering a sleep state. The application thread
executes a loop that compares the message count against a maximum number
of messages for the regulated time period; if the comparison is
favorable, then another message is transmitted and the message count is
adjusted. If the comparison is not favorable, then the application thread
enters a sleep state; after awakening, it repeats the comparison, and
depending on the result, it transmits a message or reenters a sleep
state.