Re: GThread Problem



What would cause the difference?  A bug in my version of glib?

On Fri, 2004-04-09 at 04:16, Sebastian Wilhelmi wrote:
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


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