gthreads and gobjects

2012-01-03 Thread Bernhard Schuster
Happy new year everyone! I need some info on gthread, and how it interacts with gobject based structures which get accessed by multiple threads at a time especially in the respect of deleting objects and signaling and such (I am aware of the basic locking/mutex/conditioning fun :) ) A tutorial on

Re: gthreads vs pthread

2010-10-26 Thread Chris Vine
On Tue, 26 Oct 2010 22:41:44 + Juan Pablo L. wrote: > Hello, i m using threads in a glib-only project, a service daemon, i > have implemented them using GThreads, but i see now that GThreads is > only a wrapper around pthreads (with the corresponding overhead from > doing so)

gthreads vs pthread

2010-10-26 Thread Juan Pablo L .
Hello, i m using threads in a glib-only project, a service daemon, i have implemented them using GThreads, but i see now that GThreads is only a wrapper around pthreads (with the corresponding overhead from doing so) and does not provide any additional benefit (if i dont mistake the only real

Re: gthreads and file operations

2010-04-14 Thread Chris Vine
On Wed, 14 Apr 2010 10:01:15 +0530 Nischal Rao wrote: > Let me explain the entire scenario. > > I need to be listening to a socket for data from an external program. > I do this using an infinite loop. Once i get the data, i call a > function and after it returns I go back into infinite loop agai

Re: gthreads and file operations

2010-04-13 Thread Olivier Sessink
Nischal Rao wrote: > is there any way to listen to signals without calling gtk_main() (which > never returns) ? If so, then i ll be able to get rid of > threads(happily!!) I am new to glib threads and gnome signals.. i > have just been following examples that i found on the net. What kind of s

Re: gthreads and file operations

2010-04-13 Thread Nischal Rao
Let me explain the entire scenario. I need to be listening to a socket for data from an external program. I do this using an infinite loop. Once i get the data, i call a function and after it returns I go back into infinite loop again. While all this is happening I also need to listen to some sign

Re: gthreads and file operations

2010-04-13 Thread Chris Vine
On Wed, 14 Apr 2010 00:13:38 +0530 Nischal Rao wrote: > is there any way to listen to signals without calling gtk_main() > (which never returns) ? If so, then i ll be able to get rid of > threads(happily!!) I am new to glib threads and gnome signals.. i > have just been following examples th

Re: gthreads and file operations

2010-04-13 Thread Nischal Rao
is there any way to listen to signals without calling gtk_main() (which never returns) ? If so, then i ll be able to get rid of threads(happily!!) I am new to glib threads and gnome signals.. i have just been following examples that i found on the net. Please help me. My requirement is that i

Re: gthreads and file operations

2010-04-13 Thread Olivier Sessink
Nischal Rao wrote: > the sample code is: [..] your use of threading doesn't make sense. All your threads are within a lock, so you have three threads (main + two threads) but they can never execute any instructions in parallel, because they all wait for the global gdk lock. Everything you want to

Re: gthreads and file operations

2010-04-13 Thread Nischal Rao
the sample code is: #include "myheader.h" int main(int argc, char ** argv) { GThread *l_th1, *l_th2; g_thread_init(NULL); gdk_threads_init(); gtk_init(&argc,&argv); initCommandParser(); initCurrentManager(); initWindowManager(); l_th1 = g_thread_create(_gtkthread,N

Re: gthreads and file operations

2010-04-12 Thread Tor Lillqvist
> By the way, I had never programmed using glib threads before. Is the threads > part of the code I had sent earlier correct? If you want people to actually test your code, you do need to show a *complete* compilable and *minimal* test case. In general, it's best to avoid threads. For some reason

Re: gthreads and file operations

2010-04-12 Thread Thomas Stover
On Tue, 13 Apr 2010 01:01:15 +0530, Nischal Rao wrote: >> Is the >> threads part of the code I had sent earlier correct? I haven't seen the code yet. It could be me, but the mailing list software probably scrubs attachments. Most folks just post as inline text. -- www.thomasstover.com __

Re: gthreads and file operations

2010-04-12 Thread Nader Morshed
Not sure if it's just me, but I can't see the attachment. For things like fseek and fclose, you might want to look at the gio library (http://library.gnome.org/devel/gio/stable/) which is included along with glib. On Tue, 13 Apr 2010 00:21:44 +0530 Nischal Rao wrote: > I just noticed... the co

Re: gthreads and file operations

2010-04-12 Thread Nischal Rao
the problem still persists. :( my assumption was wrong On Tue, Apr 13, 2010 at 12:43 AM, Nischal Rao wrote: > I got the problem! > > The thing is, before calling the prepareGrammar() function i am calling a > function, SPI_generateMouseEvent() which modifies the at-spi tree which is > ac

Re: gthreads and file operations

2010-04-12 Thread Nischal Rao
I got the problem! The thing is, before calling the prepareGrammar() function i am calling a function, SPI_generateMouseEvent() which modifies the at-spi tree which is accessed by prepareGrammar, i.e., i was accessing the tree while it was being modified by another external program. All i need to

Re: gthreads and file operations

2010-04-12 Thread Nischal Rao
I just noticed... the code sometimes works and sometimes doesn't work(the code doesn't go to completion which kind of confirms that there is thread lock problem). There doesn't seem to be an error in other parts of the code because the code works fine when i comment the file writing part(i.e., pre

Re: gthreads and file operations

2010-04-12 Thread Tor Lillqvist
It would be *much* easier to help you if you could show us some actual code that works strangely for you. A minimal but complete sample program, thanks. Now it is very hard to understand what you mean. --tml ___ gtk-app-devel-list mailing list gtk-app-de

Re: gthreads and file operations

2010-04-12 Thread Thomas Stover
On Mon, 12 Apr 2010 21:25:44 +0530, Nischal Rao wrote: > the files are coming empty. I suspect this is happening because of thread > lock problems... > > Have you tried a "flush" operation. ie fflush() or g_io_channel_flush()? Beyond that we would need to see some sort of code example. -- ww

Re: gthreads and file operations

2010-04-12 Thread Nischal Rao
On Mon, Apr 12, 2010 at 8:33 PM, Thomas Stover wrote: > 1) you mean glib threads right? (maybe there is a gnome thread?) > yes... i mean glib threads. > 2) you're going to want to use glib based functions like io channels > instead of stdio (for regular files at least) > 3) "don't seem to work"

Re: gthreads and file operations

2010-04-12 Thread Olivier Sessink
2010/4/12 Nischal Rao : > Hi, > > Within a gnome thread i need to read as well as write to a file. I tried > using the regular fprintf() etc but they don't seem to work. > Can somebody please help me out since I am new to gnome threads. see if you can use the GIO _async() calls, they use threads i

Re: gthreads and file operations

2010-04-12 Thread Thomas Stover
1) you mean glib threads right? (maybe there is a gnome thread?) 2) you're going to want to use glib based functions like io channels instead of stdio (for regular files at least) 3) "don't seem to work" is not enough information for anyone to help you 4) you also need a real reason to be using thr

gthreads and file operations

2010-04-12 Thread Nischal Rao
Hi, Within a gnome thread i need to read as well as write to a file. I tried using the regular fprintf() etc but they don't seem to work. Can somebody please help me out since I am new to gnome threads. Thanks in advance. -- regards, Nischal E Rao blogs.sun.com/nischal Join RVCE OSUM at http:/

Re: Gthreads again

2006-04-24 Thread Tristan Van Berkom
Fernando Apesteguía wrote: And how to kill the gthread if there is not something like pthread_cancel? (Thanks for your patience) Tell the thread it has to exit o through a variable & mutex/condition o through any form of ipc (maybe simply a pipe()) call g_thread_join() from the main thr

Gthreads again

2006-04-24 Thread Fernando Apesteguía
And how to kill the gthread if there is not something like pthread_cancel? (Thanks for your patience) Best regards -- Forwarded message -- From: Tristan Van Berkom <[EMAIL PROTECTED]> Date: 24-abr-2006 20:04 Subject: Re: Gthreads again To: Fernando Apesteguía <[EMAIL

Re: Gthreads again

2006-04-24 Thread Tristan Van Berkom
Fernando Apesteguía wrote: The main thread is the only one that is running inside the gtk_main loop. The secondary thread is only reading files. So if I do a gtk_main_quit() the secondary thread will be no longer running because I have not a gtk_main loop, right? Wrong, the main thread is not r

Gthreads again

2006-04-24 Thread Fernando Apesteguía
hread when it was created with pthread instead of g_thread? -- Forwarded message -- From: Tristan Van Berkom <[EMAIL PROTECTED]> Date: 24-abr-2006 19:21 Subject: Re: Gthreads again To: Fernando Apesteguía <[EMAIL PROTECTED]> Cc: gtk-app-devel-list@gnome.org Fernando

Re: Gthreads again

2006-04-24 Thread Tristan Van Berkom
Fernando Apesteguía wrote: [...] Now, I'm using GThreads. I don't perform a pthread_cancel nor an equivalent for GThreads, but the application appears to run well. Does gtk_main_quit() kill the secondary thread properly or should I expect a crash of my application? Threads are allo

Gthreads again

2006-04-24 Thread Fernando Apesteguía
Hi, I wrote a mail some time ago, but nobody answered me :( My problem is that I had two threads. The second one was a pthread. I performed and exit from a callback, so I had to pthread_cancel the secondary thread to avoid a race condition and an eventual app crash. Now, I'm using GThrea

Gthreads

2006-03-26 Thread Fernando Apesteguía
Hi, I'm porting an application from pthread semantic to GThreads framework. I used pthread_cancel(pid) to kill a thread, does exists something similar in gthreads? I've read http://mail.gnome.org/archives/gtk-devel-list/2003-February/msg00082.htmland it appears it doesn't

Re: gthreads missing

2005-11-30 Thread Tristan Van Berkom
Marcus Reis wrote: Hi, I dont know if is that right list to do this kind of question. When compiling an app with -lgthread ld returns "cannot find -lgthread". I'm using Ubuntu 5.10, so anybody get success using gthreads in Ubuntu 5.10?? Maybe are devel libraries compiled without g

gthreads missing

2005-11-30 Thread Marcus Reis
Hi, I dont know if is that right list to do this kind of question. When compiling an app with -lgthread ld returns "cannot find -lgthread". I'm using Ubuntu 5.10, so anybody get success using gthreads in Ubuntu 5.10?? Maybe are devel libraries compiled without gthreads support in th