How to use my glib program on other computer?

2006-02-21 Thread Peter Cai
I've written a C program based on glib on my computer.  But when I copyied it to another computer, it did not work. Do I have to install a glib on that computer? Or can I change some gcc options to compile an application which already has the library in itself?-- 那不是缺陷 只是你不在梦中 ___

Is GLIB thread safe?

2008-10-25 Thread Peter Cai
Hi all, I'm writing a COM program on windows but I'm not quite familiar with C++. thus I decided to use mostly C instead and I want to use GLIB in it. But I got one problem. Is GLIB thread safe? I read some code, such as GArray. There is no thread protection of a GArray APIs. So if more than

How to safely release a mutex?

2008-11-13 Thread Peter Cai
Hi all, Is it safe to call g_free_mutex on a locked mutex? If it's not, what is the correct way to do that? ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list

Re: How to safely release a mutex?

2008-11-13 Thread Peter Cai
(mutex); g_mutex_unlock(mutex); g_mutex_free(mutex); If thread switches just after unlock and another thread locked mutex, the code might fail. On Thu, Nov 13, 2008 at 4:41 PM, Peter Cai <[EMAIL PROTECTED]> wrote: > Hi all, > > Is it safe to call g_free_mutex on a locke

ThreadPool doesn't eat up CPU as much as possible.

2009-01-15 Thread Peter Cai
Hi, Recently I am playing with glib's threadpool APIs. I found that, in my program (on windows), the number unprocessed task of a pool is accumulated when time is going on. It seems that the threads in the pool don't have enough CPU time to run, but when I monitored my computer's CPU usage, it

How to write a Class(gobject) in a thread safe way?

2009-04-25 Thread Peter Cai
/* I wrote a class to encapsulate a GString as a buffer. * I want to make it both thread safe and efficient. I need several buffers * like this, so I don't want a global mutex to lock every instance of my buffer * class. So I add a mutex as private member. * * But when I need to free my obje

My application crashes on calling "g_print"

2009-06-08 Thread Peter Cai
Hi all, I am using oah build of glib, and I occasionally got this crash ( from windbg "analyze -v" result) : APPLICATION_HANG Seems that there is a problem with "malloc". Do you have any idea why this happen? --

I met a strange problem: after dispose g_object_ref could also succeed!

2009-06-19 Thread Peter Cai
I met a strange problem: after dispose ( or during dispose) g_object_ref could also succeed! http://pastebin.com/d631246a7 It crashes on line 24, which is almost impossible. 1st, I checked these variables. 2nd, I called g_object_ref(self) to avoid self being disposed while this function has not r

Should I chain up finalize?

2009-10-22 Thread Peter Cai
I found code like this in gio static void g_filter_input_stream_finalize (GObject *object) { GFilterInputStream *stream; stream = G_FILTER_INPUT_STREAM (object); g_object_unref (stream->base_stream); G_OBJECT_CLASS (g_filter_input_stream_parent_class)->finalize (object); } It looks lik