-/* Insert an event object into the gdb event queue at
- the specified position.
- POSITION can be head or tail, with values TAIL, HEAD.
- EVENT_PTR points to the event to be inserted into the queue.
- The caller must allocate memory for the event. It is freed
- after the event has ben handled.
- Events in the queue will be processed head to tail, therefore,
- events inserted at the head of the queue will be processed
- as last in first out. Event appended at the tail of the queue
- will be processed first in first out. */
-static void
-async_queue_event (gdb_event * event_ptr, queue_position position)
-{
- if (position == TAIL)
- {
- /* The event will become the new last_event. */
-
- event_ptr->next_event = NULL;
- if (event_queue.first_event == NULL)
- event_queue.first_event = event_ptr;
- else
- event_queue.last_event->next_event = event_ptr;
- event_queue.last_event = event_ptr;
- }
- else if (position == HEAD)
- {
- /* The event becomes the new first_event. */
-
- event_ptr->next_event = event_queue.first_event;
- if (event_queue.first_event == NULL)
- event_queue.last_event = event_ptr;
- event_queue.first_event = event_ptr;
- }
-}
-
-/* Create a generic event, to be enqueued in the event queue for
- processing. PROC is the procedure associated to the event. DATA
- is passed to PROC upon PROC invocation. */
-
-static gdb_event *
-create_event (event_handler_func proc, event_data data)
-{
- gdb_event *event;
-
- event = xmalloc (sizeof (*event));
- event->proc = proc;
- event->data = data;