mirror of
https://github.com/irssi/irssi.git
synced 2026-08-17 23:52:22 +02:00
Some changes handling g_input_add() - maybe this helps to problems
where irssi sometimes eats all the cpu. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@608 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
a2d0944eee
commit
3baf7fbd4c
6 changed files with 16 additions and 13 deletions
|
|
@ -37,12 +37,18 @@ static int irssi_io_invoke(GIOChannel *source, GIOCondition condition,
|
|||
IRSSI_INPUT_REC *rec = data;
|
||||
GInputCondition icond = 0;
|
||||
|
||||
if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
|
||||
/* error, we have to call the function.. */
|
||||
if (rec->condition & G_IO_IN)
|
||||
icond |= G_INPUT_READ;
|
||||
else
|
||||
icond |= G_INPUT_WRITE;
|
||||
}
|
||||
|
||||
if (condition & (G_IO_IN | G_IO_PRI))
|
||||
icond |= G_INPUT_READ;
|
||||
if (condition & G_IO_OUT)
|
||||
icond |= G_INPUT_WRITE;
|
||||
if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
|
||||
icond |= G_INPUT_EXCEPTION;
|
||||
|
||||
if (rec->condition & icond) {
|
||||
rec->function(rec->data, g_io_channel_unix_get_fd(source),
|
||||
|
|
@ -58,19 +64,18 @@ int g_input_add(int source, GInputCondition condition,
|
|||
IRSSI_INPUT_REC *rec;
|
||||
unsigned int result;
|
||||
GIOChannel *channel;
|
||||
GIOCondition cond = 0;
|
||||
GIOCondition cond;
|
||||
|
||||
rec = g_new(IRSSI_INPUT_REC, 1);
|
||||
rec->condition = condition;
|
||||
rec->function = function;
|
||||
rec->data = data;
|
||||
|
||||
cond = G_IO_ERR|G_IO_HUP|G_IO_NVAL;
|
||||
if (condition & G_INPUT_READ)
|
||||
cond |= (G_IO_IN | G_IO_PRI);
|
||||
cond |= G_IO_IN|G_IO_PRI;
|
||||
if (condition & G_INPUT_WRITE)
|
||||
cond |= G_IO_OUT;
|
||||
if (condition & G_INPUT_EXCEPTION)
|
||||
cond |= G_IO_ERR|G_IO_HUP|G_IO_NVAL;
|
||||
|
||||
channel = g_io_channel_unix_new (source);
|
||||
result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue