예제 #1
0
        static void ThreadGet(Object _tp)
        {
            int        error  = 0;
            TParam     tp     = (TParam)_tp;
            Connection conn   = tp.conn;
            int        nstart = tp.nStart;
            int        nitem  = tp.nSlice;

            error = GetByte(conn, nstart, nitem);
            if (error < 0)
            {
                Console.WriteLine("Test for Get Failed");
            }
        }
예제 #2
0
        static void MultiThreadGetPerfTest(Connection conn, int N, int nT)
        {
            int nslice = N / nT;
            int nstart = 0;

            Thread[] th = new Thread[nT];
            TParam[] tp = new TParam[nT];

            for (int i = 0; i < nT; i++)
            {
                tp[i] = new TParam(conn, nstart, nslice);
                th[i] = new Thread(ThreadGet);
                th[i].Start(tp[i]);
                nstart += nslice;
            }

            for (int i = 0; i < nT; i++)
            {
                th[i].Join();
            }
        }