I've got a device I'm talking to and when there are otherwise no interesting commands to send, the "status_poll" command is sent. The device takes a little while to respond, in which time a lot of stuff can happen, namely the queuing of more commands. I tried a simpler approach on my first iteration where I'd just return the default when the list was empty (not using the queue to also manage the default), but I ended up losing commands in the case where I'd sent a default message and queued a new command before the response to the default. You see, pop gets called on response, so this freshly queued command was popped before it ever had a chance to be sent. Other: been playing with dropping .tm files into common area for easy package require (queue_with_default-0.0.1.tm), also first go at TclOO ====== package provide queue_with_default 0.0.1 package require TclOO oo::class create queue_with_default { variable _queue _default _default_in_queue _default_seen constructor {default} { set _queue [list] set _default $default set _default_in_queue no set _default_seen no my pop return } method push {message} { lappend _queue $message if {$_default_in_queue && !$_default_seen} { my pop } return } method peek {} { if {$_default_in_queue} { set _default_seen yes } lindex $_queue 0 } method pop {} { set _queue [lrange $_queue 1 end] set _default_in_queue no set _default_seen no if {[llength $_queue] == 0} { my push $_default set _default_in_queue yes set _default_seen no } return } } ====== And the client code: ====== queue_with_default create commands status_poll commands peek; #the default has been seen commands push reset commands peek; #still looking at default commands pop commands peek; #now we see the reset commands pop #queue is "empty" here, unseen default at the front commands push reset commands peek; #this time we see reset because the default was never seen commands pop ====== Any doubts welcome. <>Enter Category Here