Click here to Skip to main content
15,915,164 members
Home / Discussions / C#
   

C#

 
QuestionMultithreading problem Pin
thepersonof30-May-06 11:07
thepersonof30-May-06 11:07 
Hi I know multithrading is explained in several tutorials, but I can't figure out how to terminate another thread gracefully. This is my current code. In thread1 when I dispose s I get an error... I realised this would happen with sychronisation etc. What can I do?

public class Loader<br />
    {<br />
        PNG.SplashScreen s;<br />
        Form1 f;<br />
        Thread first;<br />
        Thread second;<br />
        public Loader()<br />
        {<br />
            first = new Thread(new ThreadStart(thread1));<br />
            second = new Thread(new ThreadStart(thread2));<br />
            first.Start();<br />
            second.Start();<br />
        }<br />
        void thread1()<br />
        {<br />
            f = new Form1();<br />
            s.Dispose();            <br />
            f.ShowDialog();<br />
        }<br />
        void thread2()<br />
        {<br />
            s = new PNG.SplashScreen();<br />
            s.ShowDialog();<br />
        }<br />
    }



cheers
AnswerRe: Multithreading problem Pin
Judah Gabriel Himango30-May-06 11:13
sponsorJudah Gabriel Himango30-May-06 11:13 
AnswerRe: Multithreading problem Pin
Robert Rohde30-May-06 20:16
Robert Rohde30-May-06 20:16 
Questionadvice learn visual C# Pin
gds0930-May-06 10:56
gds0930-May-06 10:56 
AnswerRe: advice learn visual C# Pin
V.30-May-06 11:38
professionalV.30-May-06 11:38 
AnswerRe: advice learn visual C# Pin
teejayem30-May-06 14:11
teejayem30-May-06 14:11 
QuestionRecommended Books Pin
ahmed_toyin30-May-06 9:37
ahmed_toyin30-May-06 9:37 
AnswerRe: Recommended Books Pin
James Gupta30-May-06 9:59
professionalJames Gupta30-May-06 9:59 
GeneralRe: Recommended Books Pin
V.30-May-06 11:39
professionalV.30-May-06 11:39 
AnswerRe: Recommended Books [modified] Pin
Drew McGhie30-May-06 10:40
Drew McGhie30-May-06 10:40 
QuestionProblem in fetching address book Pin
Musharaf Zaheer30-May-06 9:28
Musharaf Zaheer30-May-06 9:28 
QuestionCorrect x,y co-ordinates of Form Control Pin
Darren_30-May-06 8:14
Darren_30-May-06 8:14 
AnswerRe: Correct x,y co-ordinates of Form Control Pin
led mike30-May-06 8:33
led mike30-May-06 8:33 
GeneralRe: Correct x,y co-ordinates of Form Control Pin
Darren_30-May-06 8:51
Darren_30-May-06 8:51 
QuestionShort Keys to Window Form Pin
anderslundsgard30-May-06 7:54
anderslundsgard30-May-06 7:54 
AnswerRe: Short Keys to Window Form Pin
Darren_30-May-06 8:20
Darren_30-May-06 8:20 
AnswerRe: Short Keys to Window Form Pin
kasik30-May-06 8:24
kasik30-May-06 8:24 
GeneralRe: Short Keys to Window Form Pin
anderslundsgard30-May-06 18:44
anderslundsgard30-May-06 18:44 
QuestionNever Mind: DataRelation in .NET 2.0 not serializable?!?!? [modified] Pin
Marc Clifton30-May-06 7:35
mvaMarc Clifton30-May-06 7:35 
QuestionCreating an mdb file Pin
likefood30-May-06 7:23
likefood30-May-06 7:23 
AnswerRe: Creating an mdb file Pin
Darren_30-May-06 8:24
Darren_30-May-06 8:24 
GeneralRe: Creating an mdb file Pin
likefood30-May-06 9:18
likefood30-May-06 9:18 
GeneralRe: Creating an mdb file Pin
Ed.Poore30-May-06 14:10
Ed.Poore30-May-06 14:10 
QuestionGeneric Abstract classes Pin
eggsovereasy30-May-06 6:34
eggsovereasy30-May-06 6:34 
AnswerRe: Generic Abstract classes Pin
Judah Gabriel Himango30-May-06 7:35
sponsorJudah Gabriel Himango30-May-06 7:35 

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.