Re: Two documentations details (sources IDs, interruptions)



Nicolas George wrote:
[...]
Is it safe to assume that sources IDs returned by g_source_attach or derived
functions are never 0?

  As far as I can see in the source, it is safe until a 32-bits integer
  overflow. The reason to want to know it is to be able to pack the
  information 'I have set up a timeout' along with the source ID necessary
  to cancel it.

I always write this type of code:

    if (id > 0)
        g_source_remove (...);
    id = g_timeout_add (...);

But I cant say whether it is common practice, acceptable or
advisable; personally I've made the assumption that its the
way to go :-/

Cheers,
                        -Tristan



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