Re: GThread Problem

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

 



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@xxxxxxxx              |     är himmlen så förunderligt blå
http://seppi.de                    |

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux