> 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 wai
2010/7/23 richard boaz :
> 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 w
indeed. the way i solve this is by programmatically determining the number
of CPU's available on the machine at program startup, knowing (through
testing) how much of the CPU a particular task requires, taken in
conjunction with how much the program should be allowed to "take over" the
machine. a
On Sat, 24 Jul 2010 10:16:09 +0200 richard wrote:
>
> And, while I'm here, a couple of relevant guidelines to writing
> multi-threaded code:
There's another that you've missed:
- Use as few threads as possible.
Basically, threads add overhead. You get benefit only up to the point where
there
I realized after i sent that email that it was a little rushed, and too
unqualified. So in the interest of completeness (and to avoid possible
misuse), the following addendum to the last post:
The code provided assumed a background program, i.e., not a GUI or a program
running with a main loop, s
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.
richa
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
On Thu, 22 Jul 2010 13:27:29 +0200
Øystein Schønning-Johansen wrote:
> 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 acc
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[