Hi,
    I have got problem with matrix program. Can anybody help in this...
Stuck in thread finish event...Please help me in this regard.....







Thanks & Regards,

Pragnesh Pandya
+91 9925431154
using System;
using System.Reflection;
using Alchemi.Core;
using Alchemi.Core.Owner;
using log4net;

namespace ConsoleApplication3
{
        /// <summary>
        /// Summary description for Class1.
        /// </summary>
        
        [Serializable]

        public class Matrix_thread : GThread
        {
                /// <summary>
                /// The main entry point for the application.
                /// </summary>
                
                public static int[ , ] in1=new int[10,10];
                public static int[ , ] in2=new int[10,10];
                public static int[ , ] outm=new int[10,10];
                static int n=2;
                int row=0;

                public Matrix_thread(int i)
                {
                        row=i;
                }

                public override void Start()
                {
                        int i,j;

                        try
                        {
                                for(i=0;i<n;i++)
                                {

                                        outm[row,i]=0;

                                        for(j=0;j<n;j++)
                                        {

                                                
outm[row,i]=outm[row,i]+in1[row,j]*in2[j,i];
                    
                                        }
                                }
                        }

                        catch(Exception ex)
                        {

                                Console.WriteLine(ex.ToString());
                
                        }
        }

                class Matrix
                {

                        public static GApplication app=new GApplication();

                        [STAThread]
                        static void Main(string[] args)
                        {
                                int i,j;

                                Console.WriteLine(" Press [Enter] to Start Grid 
Application ");
                                Console.ReadLine();

                                Console.WriteLine(" Enter the order of Matrix : 
");
                                n=Int16.Parse(Console.ReadLine());

                                //First Matrix

                                Console.WriteLine(" Enter the elements for 
first matrix :");

                                for(i=0;i<n;i++)
                                {

                                        for(j=0;j<n;j++)
                                        {

                                                
in1[i,j]=Int16.Parse(Console.ReadLine());
                                        }
                                }

                                //Second Matrix

                                Console.WriteLine(" Enter the elements for 
second matrix :");

                                for(i=0;i<n;i++)
                                {

                                        for(j=0;j<n;j++)
                                        {

                                                
in2[i,j]=Int16.Parse(Console.ReadLine());
                                        }
                                }

                                for(i=0;i<n;i++)
                                {
                                        app.Threads.Add(new Matrix_thread(i));
                                }

                                try
                                {

                                        // Specify Connection Properties

                                        app.Connection=new 
GConnection("localhost",9000,"user","user");

                                        // grid threads need to add

                                        app.Manifest.Add(new 
ModuleDependency(typeof(Matrix_thread).Module));

                                        // Subscribe to thread finish event

                                        app.ThreadFinish += new GThreadFinish( 
App_ThreadFinish );


                                        // Initialize the application

                                        //Init();

                                        // Start the application

                                        app.Start();

                                        //Console.ReadLine();

                                        // Stop the application

                                        //app.Stop();
                                }
                                catch(Exception ex)
                                {
                                        Console.WriteLine(ex.ToString());
                                }

                        }

                        /*public static void Init()
                        {

                                // Specify Connection Properties

                                app.Connection=new 
GConnection("localhost",9000,"user","user");

                                // grid threads need to add

                                app.Manifest.Add(new 
ModuleDependency(typeof(Matrix_thread).Module));

                                // Subscribe to thread finish event

                                app.ThreadFinish += new GThreadFinish( 
App_ThreadFinish );
                        }*/

                        private static void App_ThreadFinish(GThread thread)
                        {
                                // Cast supplied thread back to the 
Matrix_thread

                                Matrix_thread mtr=(Matrix_thread) thread;

                                Console.WriteLine("oo");

                        }
                }
        }
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
alchemi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alchemi-users

Reply via email to