Click here to Skip to main content
15,891,607 members
Home / Discussions / C#
   

C#

 
GeneralRe: Application Freeze after ScreenSaver/Workstation Lock/Display Change Pin
musefan12-Oct-09 22:57
musefan12-Oct-09 22:57 
AnswerRe: Application Freeze after ScreenSaver/Workstation Lock/Display Change Pin
Mirko198012-Oct-09 22:44
Mirko198012-Oct-09 22:44 
GeneralRe: Application Freeze after ScreenSaver/Workstation Lock/Display Change Pin
musefan12-Oct-09 23:01
musefan12-Oct-09 23:01 
GeneralRe: Application Freeze after ScreenSaver/Workstation Lock/Display Change Pin
Mirko198012-Oct-09 23:24
Mirko198012-Oct-09 23:24 
GeneralRe: Application Freeze after ScreenSaver/Workstation Lock/Display Change Pin
musefan13-Oct-09 1:55
musefan13-Oct-09 1:55 
AnswerRe: Application Freeze after ScreenSaver/Workstation Lock/Display Change Pin
musefan13-Oct-09 1:54
musefan13-Oct-09 1:54 
QuestionOutlook-like scheduling control (chart) [modified] Pin
Programm3r12-Oct-09 21:56
Programm3r12-Oct-09 21:56 
QuestionThread Control Dillema Pin
xiviliae12-Oct-09 21:52
xiviliae12-Oct-09 21:52 
I believe this may be a threading issue that i need better understanding with, please.

I have a WorkerClass, that takes in various parameters and then calculates complex math over multiple CPU cores (threaded). It builds an array of data used elsewhere in app. this part works great.

The problem is that i may need up to 100 instances of this class, and im not sure how to control the execution of this part. Heres sorta the flow im trying to get at:

Void BeginCalculation()
{
  Calc1 = new WorkerClass(param1, param2, param3);
  Calc1.Start();

  //NEED TO SOMEHOW WAIT FOR EACH CALC TO COMPLETE BEFORE MOVING TO NEXT

  Calc2 = new WorkerClass(param1, param2, param3);
  Calc2.Start();

  Calc3 = new WorkerClass(param1, param2, param3);
  Calc3.Add(Calc1.Array, Calc2.Array);

  //etc...
}


I really need to control when Calculations begin, because a few steps will combine data from previous steps. I also have the WorkerClass updating a public Status object, so i need to keep that feature in.

The only way i know how to control the flow here, is if i have a thread that is infinitely looping, and checking the thread state of the current calc instance thread. Then (on ThreadsAlive = False) calling a MoveToNextCalc() to start next. But somehow this seems like the wrong approach. Is it? Does someone have a better approach to this?

This is also using XNA, so i need to avoid tying up the Draw/Update steps, with lots of work. And really dont want tons of threads running at same time. Its currently 1 WorkerClass instance spawning 1 thread per CPU. Each thread working on a seperate section of an array.

I hope thats enough info to work with. Any help on best approach to this, greatly appreciated!
AnswerRe: Thread Control Dillema Pin
N a v a n e e t h12-Oct-09 22:10
N a v a n e e t h12-Oct-09 22:10 
GeneralRe: Thread Control Dillema Pin
xiviliae13-Oct-09 18:23
xiviliae13-Oct-09 18:23 
AnswerRe: Thread Control Dillema Pin
Luc Pattyn13-Oct-09 3:10
sitebuilderLuc Pattyn13-Oct-09 3:10 
QuestionCreating Excel files in C# witout having microsoft excel Pin
SummerBulb12-Oct-09 21:25
SummerBulb12-Oct-09 21:25 
AnswerRe: Creating Excel files in C# witout having microsoft excel Pin
stancrm12-Oct-09 21:28
stancrm12-Oct-09 21:28 
GeneralRe: Creating Excel files in C# witout having microsoft excel Pin
SummerBulb12-Oct-09 21:35
SummerBulb12-Oct-09 21:35 
AnswerRe: Creating Excel files in C# witout having microsoft excel Pin
DaveyM6913-Oct-09 2:02
professionalDaveyM6913-Oct-09 2:02 
QuestionInterface using C# with Microsoft access database Pin
julyhaluna12-Oct-09 21:12
julyhaluna12-Oct-09 21:12 
AnswerRe: Interface using C# with Microsoft access database Pin
Calla12-Oct-09 21:32
Calla12-Oct-09 21:32 
GeneralRe: Interface using C# with Microsoft access database Pin
julyhaluna12-Oct-09 21:59
julyhaluna12-Oct-09 21:59 
GeneralRe: Interface using C# with Microsoft access database Pin
Calla12-Oct-09 22:18
Calla12-Oct-09 22:18 
QuestionPDF Files Pin
Pavan Navali12-Oct-09 19:02
Pavan Navali12-Oct-09 19:02 
AnswerRe: PDF Files Pin
Calla12-Oct-09 20:16
Calla12-Oct-09 20:16 
GeneralRe: PDF Files Pin
Pavan Navali9-Nov-09 20:07
Pavan Navali9-Nov-09 20:07 
AnswerRe: PDF Files Pin
0x3c012-Oct-09 20:38
0x3c012-Oct-09 20:38 
QuestionSQLDBCommandwrapper Pin
NICE TO MEET12-Oct-09 18:10
NICE TO MEET12-Oct-09 18:10 
QuestionSqlDataAdapter.Fill() error. Pin
snayler012-Oct-09 16:57
snayler012-Oct-09 16:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.