Re: GLib source id wrap around



At 12:08 PM 10/13/2003, Havoc Pennington wrote:
>On Thu, 2003-10-09 at 20:51, Max Krasnyansky wrote:
>> I'd say we need to add something like following to that function.
>>         /* Handle wrap around. id 0 is invalid */
>>         if (!context->next_id)
>>                 context->next_id = 1;
>
>That doesn't do any good, because it doesn't keep you from colliding
>with existing source IDs. 
Yeah. Owen already mentioned that.

>To make wraparound work you would need to keep
>track of all outstanding IDs and pick the next unused one.
Or find some other means to guaranty uniqueness. On 32bit
platforms we can just used address of the Source as unique Id.

>The current assumption is simply that wraparound won't happen.
Which is probably not a good assumption.

Max




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]