Click here to Skip to main content
15,921,959 members
Home / Discussions / C#
   

C#

 
GeneralRe: Xml Pin
V.3-Nov-06 10:52
professionalV.3-Nov-06 10:52 
Questionhandle Pin
ammoh3-Nov-06 3:46
ammoh3-Nov-06 3:46 
AnswerRe: handle Pin
Judah Gabriel Himango3-Nov-06 6:24
sponsorJudah Gabriel Himango3-Nov-06 6:24 
Questiondelete error from database Pin
Ashraf zia3-Nov-06 3:45
Ashraf zia3-Nov-06 3:45 
AnswerRe: delete error from database Pin
Elina Blank3-Nov-06 3:49
sitebuilderElina Blank3-Nov-06 3:49 
AnswerRe: delete error from database Pin
Russell Jones3-Nov-06 3:51
Russell Jones3-Nov-06 3:51 
AnswerRe: delete error from database Pin
ednrgc3-Nov-06 5:02
ednrgc3-Nov-06 5:02 
Questiondesign issues multi threading Pin
ekynox3-Nov-06 3:03
ekynox3-Nov-06 3:03 
G'day folks,

At the moment I am writing a little application which utilities multi threading to do some processing. Essentially, my application creates a fixed number of threads,i.e. 5. Each thread when started performs three main tasks which represents the operational states the thread is in. The operational state is essentially a particular method that is executed to perform the specific task.

In my current design I have created a global array which contains five elements to hold each thread's operational state. Each time the thread moves to a new operational state, the thread's operation state value is changed in the array. I have used the correct locking processes on the array when a thread has to update it. Here is some code which shows I how the thread is started:

int []operationalStateArray = new int[5];
void Main(string[] args)
{
Thread[] ThreadArray = new Thread[5];
MyClass myclass = new MyClass();
myclass.FetchStatusArray(ref operationalStateArray);
operationalStateArray [0] = 1; //1 implies encoding task
ThreadArray[0] = new Thread(new ThreadStart(myclass.ProcessData));
ThreadArray[0].Start();
ThreadArray[0].Join();
}
Having explained my application, my question is that: Is the approach I have taken in accessing the global array using threads is okay or are there better solutions? Is it okay to pass operationalStateArray as a reference to be manipulated by the ProcessData method in MyClass?

If anyone can give me their feedback on this I would most appreciate it.
cheers
Vee
AnswerRe: design issues multi threading Pin
beatles16924-Nov-06 2:06
beatles16924-Nov-06 2:06 
GeneralRe: design issues multi threading Pin
ekynox8-Nov-06 15:58
ekynox8-Nov-06 15:58 
Questionprint array string's content into messagebox Pin
Yustme3-Nov-06 2:55
Yustme3-Nov-06 2:55 
AnswerRe: print array string's content into messagebox Pin
Guffa3-Nov-06 3:38
Guffa3-Nov-06 3:38 
QuestionSelect Resource Dialog Pin
Gomac3-Nov-06 2:41
Gomac3-Nov-06 2:41 
AnswerRe: Select Resource Dialog Pin
LongRange.Shooter3-Nov-06 7:57
LongRange.Shooter3-Nov-06 7:57 
QuestionCustom ObjectDataSource paging Pin
danidanidani3-Nov-06 2:21
danidanidani3-Nov-06 2:21 
Questionhow can i make runtime installer using C# .NET? Pin
Irfan Kothari3-Nov-06 1:53
Irfan Kothari3-Nov-06 1:53 
QuestionChanging a dataconnetion's connection string at runtime in vs2005 Pin
rzvme3-Nov-06 1:49
rzvme3-Nov-06 1:49 
AnswerRe: Changing a dataconnetion's connection string at runtime in vs2005 Pin
LongRange.Shooter3-Nov-06 8:04
LongRange.Shooter3-Nov-06 8:04 
QuestionMulticast Delegate Pin
Mairaaj Khan3-Nov-06 0:29
professionalMairaaj Khan3-Nov-06 0:29 
AnswerRe: Multicast Delegate Pin
rah_sin3-Nov-06 0:40
professionalrah_sin3-Nov-06 0:40 
GeneralRe: Multicast Delegate Pin
Mairaaj Khan3-Nov-06 0:46
professionalMairaaj Khan3-Nov-06 0:46 
GeneralRe: Multicast Delegate Pin
rah_sin3-Nov-06 0:52
professionalrah_sin3-Nov-06 0:52 
GeneralRe: Multicast Delegate Pin
Mairaaj Khan3-Nov-06 19:44
professionalMairaaj Khan3-Nov-06 19:44 
AnswerRe: Multicast Delegate Pin
Bijesh3-Nov-06 2:43
Bijesh3-Nov-06 2:43 
AnswerRe: Multicast Delegate Pin
ednrgc3-Nov-06 3:16
ednrgc3-Nov-06 3:16 

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.