Re: Bug in log.c

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Wapme Systems AG
Message-ID <[email protected]>
Michael Mulcahy schrieb:
> 
> > so what if I have a thread 10 which is a EMI/UCP process and
> > suddendly a new process gets added with 1034? we have a new conflict...
> 
> No, that what I thought as well, but the gwthread-pthread.c takes
> care of that problem.
> 
> see gwthread-pthread.c
> 
>     /* Find a free table entry and claim it. */
>     first_try = next_threadnumber;
>     do {
>         ti->number = next_threadnumber++;
>         /* Check if we looped all the way around the thread table. */
>         if (ti->number == first_try + THREADTABLE_SIZE) {
>             panic(0, "Cannot have more than %d active threads",
>                   THREADTABLE_SIZE);
>         }
>     } while (THREAD(ti->number) != NULL);
>     THREAD(ti->number) = ti;
> 
>     active_threads++;
> 
> where THREAD(t) is:
> #define THREAD(t) (threadtable[(t) % THREADTABLE_SIZE])
> 
> The thread number is incremented and the mod 1024 position in
> array is checked to see if an entry exists. If an entry exists then
> the thread number is incremented again.

ok, once again I'll chance my opinion ;))

Andreas, do you agree that a (gwthread_self() % THREADTABLE_SIZE)
gives us a runtime unque ID of the thread?

Stipe

[email protected]
-------------------------------------------------------------------
Wapme Systems AG

Vogelsanger Weg 80
40470 Düsseldorf

Tel: +49-211-74845-0
Fax: +49-211-74845-299

E-Mail: [email protected]
Internet: http://www.wapme-systems.de
-------------------------------------------------------------------
wapme.net - wherever you are
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.