thread not working?
- From: Dodiesis <dodiesis sgrunt net>
- To: gtk-app-devel-list gnome org
- Subject: thread not working?
- Date: Sat, 18 Dec 2004 16:42:24 +0100
HI all...
sample program:
-------
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
GThread* id_thread_one;
gpointer thread_one(gpointer data){
while(1){
fprintf(stderr, "Thread one pid: %d\n", getpid());
sleep(1);
}
}
int main(int argc, char *argv[]) {
if (!g_thread_supported ())
g_thread_init (NULL);
else
exit(1);
if ( (id_thread_one=g_thread_create(thread_one, NULL, TRUE,
NULL))==NULL ){
fprintf(stderr, "error 1\n");
exit(1);
}
while(1){
fprintf(stderr, "Main loop pid: %d\n", getpid());
sleep(1);
}
}
----------
on an debian woody (glib version:2.2.3-0jds1) works fine...
but on a debian sid (glib 2.4.8-1) this is the output:
$ ./thread_test
Main loop pid: 4855
Thread one pid: 4855
Main loop pid: 4855
Thread one pid: 4855
Main loop pid: 4855
Thread one pid: 4855
?!?!
something missing?
tnx!
--
Dodiesis <dodiesis sgrunt net>
Sgrunt.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]