diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-09-13 21:40:00 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-09-13 21:40:00 +0000 |
commit | cff3e48be70e018476521d0f62705c29f4112771 (patch) | |
tree | 09899684e1ac06491418cb186525498ba0a60544 /gdb/event-loop.c | |
parent | 59f2c4e703f7c5f894322210c24e0ffc4c1c56eb (diff) | |
download | gdb-cff3e48be70e018476521d0f62705c29f4112771.zip gdb-cff3e48be70e018476521d0f62705c29f4112771.tar.gz gdb-cff3e48be70e018476521d0f62705c29f4112771.tar.bz2 |
import gdb-1999-09-13 snapshot
Diffstat (limited to 'gdb/event-loop.c')
-rw-r--r-- | gdb/event-loop.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/gdb/event-loop.c b/gdb/event-loop.c index 78ecb63..261c838 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -122,6 +122,7 @@ static int async_handler_ready = 0; static void create_file_handler PARAMS ((int, int, handler_func *, gdb_client_data)); static void invoke_async_signal_handler PARAMS ((void)); +static void handle_file_event PARAMS ((int)); static int gdb_wait_for_event PARAMS ((void)); static int gdb_do_one_event PARAMS ((void)); static int check_async_ready PARAMS ((void)); @@ -164,6 +165,22 @@ async_queue_event (event_ptr, position) } } +/* Create a file event, to be enqueued in the event queue for + processing. The procedure associated to this event is always + handle_file_event, which will in turn invoke the one that was + associated to FD when it was registered with the event loop. */ +gdb_event * +create_file_event (fd) + int fd; +{ + gdb_event *file_event_ptr; + + file_event_ptr = (gdb_event *) xmalloc (sizeof (gdb_event)); + file_event_ptr->proc = handle_file_event; + file_event_ptr->fd = fd; + return (file_event_ptr); +} + /* Process one event. The event can be the next one to be serviced in the event queue, or an asynchronous event handler can be invoked in response to @@ -439,11 +456,6 @@ delete_file_handler (fd) if (file_ptr == NULL) return; - /* Deactivate the file descriptor, by clearing its mask, - so that it will not fire again. */ - - file_ptr->mask = 0; - #ifdef HAVE_POLL /* Create a new poll_fds array by copying every fd's information but the one we want to get rid of. */ @@ -500,6 +512,11 @@ delete_file_handler (fd) } #endif /* HAVE_POLL */ + /* Deactivate the file descriptor, by clearing its mask, + so that it will not fire again. */ + + file_ptr->mask = 0; + /* Get rid of the file handler in the file handler list. */ if (file_ptr == gdb_notifier.first_file_handler) gdb_notifier.first_file_handler = file_ptr->next_file; @@ -634,10 +651,7 @@ gdb_wait_for_event () this fd. */ if (file_ptr->ready_mask == 0) { - file_event_ptr = - (gdb_event *) xmalloc (sizeof (gdb_event)); - file_event_ptr->proc = handle_file_event; - file_event_ptr->fd = file_ptr->fd; + file_event_ptr = create_file_event (file_ptr->fd); async_queue_event (file_event_ptr, TAIL); } } @@ -671,10 +685,7 @@ gdb_wait_for_event () if (file_ptr->ready_mask == 0) { - file_event_ptr = - (gdb_event *) xmalloc (sizeof (gdb_event)); - file_event_ptr->proc = handle_file_event; - file_event_ptr->fd = file_ptr->fd; + file_event_ptr = create_file_event (file_ptr->fd); async_queue_event (file_event_ptr, TAIL); } file_ptr->ready_mask = mask; |