Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
GeneralRe: Writing source code in seperate files Pin
PIEBALDconsult28-Jan-12 13:37
mvePIEBALDconsult28-Jan-12 13:37 
AnswerRe: Writing source code in seperate files Pin
BobJanova28-Jan-12 6:32
BobJanova28-Jan-12 6:32 
QuestionSimple MultiThread question Pin
PozzaVecia27-Jan-12 20:51
PozzaVecia27-Jan-12 20:51 
AnswerRe: Simple MultiThread question Pin
OriginalGriff27-Jan-12 21:14
mveOriginalGriff27-Jan-12 21:14 
GeneralRe: Simple MultiThread question Pin
PozzaVecia28-Jan-12 1:21
PozzaVecia28-Jan-12 1:21 
GeneralRe: Simple MultiThread question Pin
OriginalGriff28-Jan-12 2:41
mveOriginalGriff28-Jan-12 2:41 
AnswerRe: Simple MultiThread question Pin
Luc Pattyn27-Jan-12 22:22
sitebuilderLuc Pattyn27-Jan-12 22:22 
GeneralRe: Simple MultiThread question Pin
PozzaVecia28-Jan-12 1:56
PozzaVecia28-Jan-12 1:56 
Thank you for your very good answer. My question was incomplete.
Basically I also need a thread called "total" that sum the "y" calculated in C.
For do that I have 2 problem:
-> total has to wait each C to finish
-> total has to get data from each C (how passing data?)

Frown | :(



C#
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading;



namespace mtquestion

{

    class Program

    {

       

        static void Main(string[] args)

        {



           

            Thread T1 = new Thread(new ParameterizedThreadStart(C));

            Thread T2 = new Thread(new ParameterizedThreadStart(C));

            Thread T3 = new Thread(new ParameterizedThreadStart(C));

         



            

            T1.Start(15000000);

            T2.Start(25000000);

            T3.Start(60000);



           

            T1.Join();

            T2.Join();

            T3.Join();

        

            Console.WriteLine("All 3 done");



        }



        //dummy function to spend time

        public static void C(object i) 

        {

            

           double y = 0.0;

            for (int j = 1; j<(int) i; j++)

            {

                y += Math.Log(Math.Exp(0.06)) * Math.Log(Math.Exp(0.06)) / Math.Log(Math.Exp(0.06)) * Math.Log(Math.Exp(0.06)); 

            }

            

            Console.WriteLine(i);

        }

        public static void Total(object j) 

        {

        //..... sum y of each
 C(..) when conclueded
        }

			

    }

}

AnswerRe: Simple MultiThread question Pin
Luc Pattyn28-Jan-12 2:29
sitebuilderLuc Pattyn28-Jan-12 2:29 
GeneralRe: Simple MultiThread question Pin
harold aptroot28-Jan-12 2:24
harold aptroot28-Jan-12 2:24 
AnswerRe: Simple MultiThread question Pin
Luc Pattyn28-Jan-12 2:50
sitebuilderLuc Pattyn28-Jan-12 2:50 
AnswerRe: Simple MultiThread question Pin
BobJanova28-Jan-12 6:45
BobJanova28-Jan-12 6:45 
GeneralRe: Simple MultiThread question Pin
PozzaVecia28-Jan-12 9:50
PozzaVecia28-Jan-12 9:50 
QuestionConverting MySqlDateTime Pin
Ian_urquhart27-Jan-12 4:50
Ian_urquhart27-Jan-12 4:50 
AnswerRe: Converting MySqlDateTime Pin
Bernhard Hiller27-Jan-12 5:01
Bernhard Hiller27-Jan-12 5:01 
GeneralRe: Converting MySqlDateTime Pin
Ian_urquhart27-Jan-12 5:27
Ian_urquhart27-Jan-12 5:27 
AnswerRe: Converting MySqlDateTime Pin
PIEBALDconsult27-Jan-12 5:08
mvePIEBALDconsult27-Jan-12 5:08 
GeneralRe: Converting MySqlDateTime Pin
Ian_urquhart27-Jan-12 5:31
Ian_urquhart27-Jan-12 5:31 
GeneralRe: Converting MySqlDateTime Pin
Richard Andrew x6427-Jan-12 16:43
professionalRichard Andrew x6427-Jan-12 16:43 
GeneralRe: Converting MySqlDateTime Pin
PIEBALDconsult28-Jan-12 4:03
mvePIEBALDconsult28-Jan-12 4:03 
GeneralRe: Converting MySqlDateTime Pin
jschell28-Jan-12 4:39
jschell28-Jan-12 4:39 
GeneralRe: Converting MySqlDateTime Pin
PIEBALDconsult28-Jan-12 12:05
mvePIEBALDconsult28-Jan-12 12:05 
GeneralRe: Converting MySqlDateTime Pin
jschell28-Jan-12 13:54
jschell28-Jan-12 13:54 
QuestionSocket server handling MySQL queries from clients and return the response to them Pin
Islorvat27-Jan-12 4:48
Islorvat27-Jan-12 4:48 
AnswerRe: Socket server handling MySQL queries from clients and return the response to them Pin
Richard Andrew x6427-Jan-12 7:30
professionalRichard Andrew x6427-Jan-12 7:30 

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.