Implemented the MessageLoop class using a circular doubly linked list