January 10, 2009 object splitting in multiple threads | ||||
---|---|---|---|---|
| ||||
How bad is the following idea? class Calc { void addThread() { Data data; data = new Data(); } void run() { if ( hardware threads > current threadcount) { addThread(); } //wait for some signal //run calculations on data / threads } } Calc mainCalc; mainCalc = new Calc(); mainCalc.run(); |
January 10, 2009 Re: object splitting in multiple threads | ||||
---|---|---|---|---|
| ||||
Posted in reply to yes | On Sat, 10 Jan 2009 05:44:20 +0300, yes <yes@no.com> wrote:
> How bad is the following idea?
>
>
> class Calc
> {
>
> void addThread()
> {
> Data data;
> data = new Data();
> }
>
> void run()
> {
> if ( hardware threads > current threadcount)
> {
> addThread();
> }
>
> //wait for some signal
> //run calculations on data / threads
>
> }
>
> }
>
> Calc mainCalc;
> mainCalc = new Calc();
> mainCalc.run();
>
>
What does this code do? It looks like a ThreadPool use case but I might be wrong.
|
Copyright © 1999-2021 by the D Language Foundation