Re: Installing GTK Binary Packages Into MINGW on MS Windows Using Wascana and Eclipse

2010-08-18 Thread Øystein Schønning-Johansen
On Wed, Aug 18, 2010 at 8:07 PM, Peter Willis pwil...@aslenv.com wrote:

 Hello,

 I would like to use mingw to port and compile a simple GTK application
 under MS Windows.

 The download page for windows located at:

 http://www.gtk.org/download-windows.html

 recommends the mingw tool chain and contains tables of relevant packages as
 well as dependencies.

 I have downloaded the various required packages and dependencies
 marked 'Dev' on that page.

 What is unclear from any installation instructions I
 have been able to find is where and how to install these
 packages into mingw.

 Do I simply decompress the archives in the mingw directory
 hierarchy so that the files end up in the respective directories there?

 *or*

 Do I need to make separate hierarchies for each of the zip files
 and point GCC at the 'lib' and 'header' directories using '-L -l'
 and '-I -i' flags respectively?


I've used GTK and glib with mingw for many years now, and I've always put
mingw in c:\mingw and all the gtk stuff in c:\gtk.

This works perfectly, and I usually also add some simple unix-ish tools such
that I can mimic a unix system at a dos prompt.

To make all include and linking simple I usually have a makefile that
contains these lines:

INCLUDE = -I/C/GTK/include $(shell pkg-config --cflags gtk+-2.0)
LIBS = $(shell pkg-config --libs gtk+-2.0)

... or somthing similar depending on what I need.

I would not recommend to put GTK and MinGW in the same directories!

-Øystein
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GThreads and GThreadPool help for a dummy

2010-07-27 Thread Øystein Schønning-Johansen
 However back to my code:
  pool = g_thread_pool_new( my_calc, (gpointer) common, 8, FALSE, err );

  for (i = 0; i  n_tot; i++ )
          g_thread_pool_push( pool, store[i], err );

  g_thread_pool_free( pool, FALSE, TRUE );

 Why doesn't the g_thread_pool_free function stop and wait for all
 threads. I really specify this to wait (the third parameter is wait_
 and set TRUE). In my understanding this must then be a bug in glib.
 Should I fill in a bug report?

Oh my! What a blunder. I got the parameters in my_calc() swapped. It
then just returned without calculating anything. I fixed this, and it
now seems to work. The documentation on this is a bit unclear, and may
need some polishing, but there is no bug.

Scaling is a bit strange though! I'm working on a box with 2 intel
xeon quad core processors and would therefore expect to get a close
linear speed up from 1 -8 threads. Here's the results:

Threads  execution time [sec]
   1 14.38
   2 11.73
   3  7.59
   4  6.42
   5  5.89
   6 14.91
   7 33.94
   8 35.00

Is it the mutex lock and unlock that gives all this overhead when
there's many threads. I'll try splitting the array and see if that
gives better scalability.

-Øystein
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GThreads and GThreadPool help for a dummy

2010-07-24 Thread Øystein Schønning-Johansen
2010/7/23 richard boaz ivor.b...@gmail.com:
 this is how i do it (not using pools), i have modified my code for your
 purposes, though it's probably wrong somewhere in the implementation details
 (i didn't even compile it), but i leave that to you.
 this is very easily generalizable to do any kind of background work on a
 list of items.

Thanks for the code. I'll try it out. I think the pool code in glib
works similar, except that it uses an asynchronous queue.

However back to my code:
  pool = g_thread_pool_new( my_calc, (gpointer) common, 8, FALSE, err );

  for (i = 0; i  n_tot; i++ )
  g_thread_pool_push( pool, store[i], err );

  g_thread_pool_free( pool, FALSE, TRUE );

Why doesn't the g_thread_pool_free function stop and wait for all
threads. I really specify this to wait (the third parameter is wait_
and set TRUE). In my understanding this must then be a bug in glib.
Should I fill in a bug report?

-Øystein
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GThreads and GThreadPool help for a dummy

2010-07-23 Thread Øystein Schønning-Johansen
I tried, and the new problem is now:

  pool = g_thread_pool_new( my_calc, (gpointer) common, 8, FALSE, err );

  for (i = 0; i  n_tot; i++ )
  g_thread_pool_push( pool, store[i], err );

  g_thread_pool_free( pool, FALSE, TRUE );

When I run this code, it continues without waiting for the threads to
complete. I expected that the g_thread_pool_free function would make it wait
for all threads to complete before the program code continues, however
it does not! How can I make it wait?

(Yes, I added a static mutex in my_func. I'm convinced that I need it. )

-Øystein
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


GThreads and GThreadPool help for a dummy

2010-07-22 Thread Øystein Schønning-Johansen
Hi,

I'm not really experienced when it comes to threading, and GThreads is
the thing I want to use, since (I assume) it's quite portable.

I have a function that returns a gfloat and I call the function
sequentially and accumulate the total.
Like this:

/* My sequential pseudo code */
data_t data[N_DATAPOINTS];
gfloat tot_err = 0.0f;
guint i;

fill_the_data_array( data );

for ( i = 0; i  N_DATAPOINTS; i++ )
tot_err += calc_error( data[i] );

/* End of my sequential pseudo code */

I have the impression that this should be rather simple to thread
for-loop. Since addition is commutative, I may not even need a mutex
for the tot_err variable.

Can anyone point me in the right direction?

-Øystein
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list