Delayed Message Processing?

I’ve been working with a 3rd-party multiplayer engine for a game I’m developing. A lot of messages get sent during certain times (loading, etc) to the point where it is possible that multiple messages may be sent per gameloop. To solve this problem, I am attempting to create a delayed message processing scheme. Essentially, this function is invoked every time a new message is received:


        // called by the Client
        public function PushMessage(gameMsg:GameMessage):void
        {
            messageQueue.push(gameMsg);
        }

And at a point in the gameloop, I want to process these messages and clear the message queue. The only problem: there is no assurance that the messageQueue won’t be modified during that time. The messages in AS3 are basically interrupts (possibly overlapping), and I can’t find any way to temporarily disable event dispatching for a specific EventDispatcher-derived class.

So at this point I can think of only two options. The first is to write a mutex using a Boolean and setTimeout. I do not want to do this for obvious reasons (bad! BAD!). The second is to give up on a delayed processing model.

Any ideas? Is there a nice way to tell an EventDispatcher to stop invoking listeners and simply queue messages?