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

C#

 
AnswerRe: No value given for one or more required parameters. Pin
Luc Pattyn19-Oct-09 13:41
sitebuilderLuc Pattyn19-Oct-09 13:41 
AnswerRe: No value given for one or more required parameters. Pin
_Maxxx_20-Oct-09 19:12
professional_Maxxx_20-Oct-09 19:12 
QuestionWindows application Pin
or or19-Oct-09 11:34
or or19-Oct-09 11:34 
AnswerRe: Windows application Pin
Eddy Vluggen19-Oct-09 11:54
professionalEddy Vluggen19-Oct-09 11:54 
GeneralRe: Windows application Pin
or or19-Oct-09 20:24
or or19-Oct-09 20:24 
AnswerRe: Windows application Pin
Not Active19-Oct-09 13:15
mentorNot Active19-Oct-09 13:15 
QuestionRe: Windows application Pin
or or20-Oct-09 0:06
or or20-Oct-09 0:06 
QuestionMagical thread? [modified] Pin
Scalee19-Oct-09 10:42
Scalee19-Oct-09 10:42 
I want to remove a bottleneck using a second thread, but my thread dies but the object lives on..
So i don't seem to understand whats going with my thread let me try to explain:

Starter code:
<br />
            //new thread object (thread declared as Thread msnthread;)<br />
            //create the new thread with a threadstart pointing to StartMSN<br />
            msnthread = new Thread(new ThreadStart(StartMSN));<br />
            //Start the thread<br />
            msnthread.Start();<br />


Function code:
<br />
       private void StartMSN()<br />
        {<br />
            //start label<br />
            start:<br />
                try<br />
                {<br />
                    //check if msn is running if not abort<br />
                    if (Process.GetProcessesByName("msnmsgr").Length != 0)<br />
                    {<br />
                        //New msn class object (declared as MSN Msnclass;)<br />
                        Msnclass = new MSN();<br />
                        //Add an event handler and point it to this.Cout<br />
                        Msnclass.Cout += new MSN.cout(Cout);<br />
                    }<br />
                    else<br />
                    {<br />
                        //Sleep for 10 seconds and retry<br />
                        Thread.Sleep(10000);<br />
                        goto start;<br />
                    }<br />
                }<br />
                catch (Exception e)<br />
                {<br />
                    //on crash print error and sleep for 10 seconds<br />
                    Cout("Fatal error: \n" + e.Message);<br />
                    Thread.Sleep(10000);<br />
                    //goto start label and recreate object<br />
                    goto start;<br />
                }<br />
        }<br />


After this code has run, the thread dies but the Msnclass keeps alive, but is it still threaded??
What am i doing wrong, also what would be a better way to restart instead of the goto start?

Thanks!

modified on Monday, October 19, 2009 6:23 PM

AnswerRe: Magical thread? [modified] Pin
Luc Pattyn19-Oct-09 11:39
sitebuilderLuc Pattyn19-Oct-09 11:39 
GeneralRe: Magical thread? Pin
Scalee19-Oct-09 12:23
Scalee19-Oct-09 12:23 
AnswerRe: Magical thread? Pin
Luc Pattyn19-Oct-09 12:43
sitebuilderLuc Pattyn19-Oct-09 12:43 
GeneralRe: Magical thread? Pin
Scalee19-Oct-09 21:39
Scalee19-Oct-09 21:39 
GeneralRe: Magical thread? Pin
Luc Pattyn20-Oct-09 1:36
sitebuilderLuc Pattyn20-Oct-09 1:36 
QuestionVisual Studio managing my project files Pin
LimitedAtonement19-Oct-09 9:59
LimitedAtonement19-Oct-09 9:59 
AnswerRe: Visual Studio managing my project files Pin
Not Active19-Oct-09 10:08
mentorNot Active19-Oct-09 10:08 
GeneralRe: Visual Studio managing my project files Pin
LimitedAtonement19-Oct-09 10:14
LimitedAtonement19-Oct-09 10:14 
GeneralRe: Visual Studio managing my project files Pin
Not Active19-Oct-09 10:25
mentorNot Active19-Oct-09 10:25 
GeneralRe: Visual Studio managing my project files Pin
LimitedAtonement19-Oct-09 10:52
LimitedAtonement19-Oct-09 10:52 
GeneralRe: Visual Studio managing my project files Pin
Not Active19-Oct-09 11:03
mentorNot Active19-Oct-09 11:03 
GeneralRe: Visual Studio managing my project files Pin
Alan N19-Oct-09 10:31
Alan N19-Oct-09 10:31 
GeneralRe: Visual Studio managing my project files Pin
Not Active19-Oct-09 10:40
mentorNot Active19-Oct-09 10:40 
GeneralRe: Visual Studio managing my project files Pin
LimitedAtonement19-Oct-09 10:54
LimitedAtonement19-Oct-09 10:54 
QuestionLooking for good File Based database for C# client. Pin
mittalpa19-Oct-09 9:02
mittalpa19-Oct-09 9:02 
AnswerRe: Looking for good File Based database for C# client. Pin
EliottA19-Oct-09 9:32
EliottA19-Oct-09 9:32 
JokeRe: Looking for good File Based database for C# client. Pin
Not Active19-Oct-09 10:10
mentorNot Active19-Oct-09 10:10 

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.