[Dovecot] [PATCH] pass struct io * to io_loop_handle_add()/io_loop_handle_remove()

Timo Sirainen tss at iki.fi
Tue Aug 24 19:58:05 EEST 2004

On 24.8.2004, at 14:05, Andrey Panin wrote:

>> I guess it could be simply changed to use reference counting instead 
>> of
>> the delayed destroying. Hmm. Looks like ioloop code could use several
>> optimizations..
> Reference counting... Hmm, I thinked about replacing ioloop->ios single
> linked list with doubly linked list, it should make removal of io 
> entries
> easy and loop in the io_add() function can be removed too.

Actually now I remember the real problem why I did delayed destroying. 
Because io_remove() may remove any one of the io structures and it can 
be called inside the io callback, it wasn't possible to know what the 
next valid io structure would be because the current and next ones 
might have been freed already.

Anyway, simple to fix. Keep the next io pointer in ioloop struct and if 
io_remove() wants to free it, it updates the next pointer.

Doubly linked lists would be good too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://dovecot.org/pipermail/dovecot/attachments/20040824/c79ff0a6/attachment-0001.bin>

More information about the dovecot mailing list