A method and apparatus is provided for providing and integrating
high-performance message queues. "Contexts" are provided that allow
independent worlds to be created and execute in parallel. A context is
created with one or more threads. Each object is created with context
affinity, allowing any thread inside the context to modify the object or
process pending messages. Threads in a different context are unable to
modify the object or process pending messages for that context. To help
achieve scalability and context affinity, both global and thread-local
data is often moved into the context. Remaining global data has
independent locks, providing synchronized access for multiple contexts.
Each context has multiple message queues to create a priority queue.
There are default queues for sent messages and posted messages,
carry-overs from legacy window managers, with the ability to add new
queues on demand. A queue bridge is also provided for actually processing
the messages.