R
rajesh
Hi,
I have some doubts about threadpool.
I have a function which does some calculation for long time and writes
the results to a file. Since I have to do multiple call to the same
functions, I used threadpool.
here is the snap shot of the function in brief...
private void DoMath(object Items)
{
//calculate another object and gets some value
.....
//writes the value to the file whose defination is defined as
global
........
//calculation here
........
Writes the value to the file
//calculate another object and gets some value
.....
//writes the value to the file whose defination is defined as
global
........
File.Flush()
}
I have to open 5 to 15 simultaneous calls to DoMath object.
I still couldn't make it work but I have couple of questions here.
1. File.Flush -- Will this writes all the value for the current
component or will it write all the values from other component ?.
2. if the above solution doesn't work...how do i organize the data in
this scenario ?.
3. How do I check all the threads excecuted successfully ?.
I used in main
int mWorkerThreads;
int mPortThreads;
int aWorkerThreads;
int aPortThreads;
ThreadPool.GetMaxThreads(out mWorkerThreads, out mPortThreads);
ThreadPool.GetAvailableThreads(out aWorkerThreads, out
aPortThreads);
if (mWorkerThreads == aWorkerThreads && mPortThreads ==
aPortThreads)
// Thread worked successfully...
I dont think it works fine though...
It will be helpful if you give some pointer to any website which
explains this..
Thanks.....
I have some doubts about threadpool.
I have a function which does some calculation for long time and writes
the results to a file. Since I have to do multiple call to the same
functions, I used threadpool.
here is the snap shot of the function in brief...
private void DoMath(object Items)
{
//calculate another object and gets some value
.....
//writes the value to the file whose defination is defined as
global
........
//calculation here
........
Writes the value to the file
//calculate another object and gets some value
.....
//writes the value to the file whose defination is defined as
global
........
File.Flush()
}
I have to open 5 to 15 simultaneous calls to DoMath object.
I still couldn't make it work but I have couple of questions here.
1. File.Flush -- Will this writes all the value for the current
component or will it write all the values from other component ?.
2. if the above solution doesn't work...how do i organize the data in
this scenario ?.
3. How do I check all the threads excecuted successfully ?.
I used in main
int mWorkerThreads;
int mPortThreads;
int aWorkerThreads;
int aPortThreads;
ThreadPool.GetMaxThreads(out mWorkerThreads, out mPortThreads);
ThreadPool.GetAvailableThreads(out aWorkerThreads, out
aPortThreads);
if (mWorkerThreads == aWorkerThreads && mPortThreads ==
aPortThreads)
// Thread worked successfully...
I dont think it works fine though...
It will be helpful if you give some pointer to any website which
explains this..
Thanks.....