Re: GThread Problem



Hi Bryan,

> Based on the Glib documentation, it is my understanding that
> g_thread_self() should return a pointer to the thread from which the
> function is called.  

That should indeed be the case.

> However, when I compare the pointer stored from g_thread_create() with
> that which is returned by g_thread_self() I get different addresses.

That shouldn't happen.

The following code does, what you would expect.

#include <glib.h>

void* 
thread_func(void *anything)
{    
  GThread *thread;    
  thread = g_thread_self ();
  g_print ("%x\n", thread);
}

int 
main (void)
{    
  GThread *thread;
  g_thread_init (NULL);
  thread = g_thread_create (thread_func,NULL,FALSE,NULL);
  g_print ("%x\n", thread);
}

Bye,
Sebastian
-- 
Sebastian Wilhelmi                 |            här ovanför alla molnen
mailto:seppi seppi de              |     är himmlen så förunderligt blå
http://seppi.de                    |




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