コード例 #1
0
        private static void writeRatePage()
        {
            long parsedDate = parsedDateTime / 1000000L;

            using (MutexObject.section(Consts.MTX_OUTPUT))
            {
                foreach (string code in currencyPairs.Keys)
                {
                    CurrencyData i = currencyPairs[code];

                    string wFile = Path.Combine(wRootDir, parsedDate + "_" + code + ".act");
                    string line  =
                        parsedDateTime + "," +
                        i.sOpen + "," +
                        i.sHigh + "," +
                        i.sLow + "," +
                        i.sAsk + "," +
                        i.sBid;

                    Console.WriteLine("< " + line);
                    Console.WriteLine("> " + wFile);

                    File.AppendAllLines(wFile, new string[] { line }, Encoding.ASCII);

                    Console.WriteLine("write-ok");
                }
            }
        }
コード例 #2
0
        public EngineTh()
        {
            try
            {
                init();
            }
            catch (Exception e)
            {
                FaultOperation.caught(e);
            }

            th = new Thread((ThreadStart) delegate
            {
                while (death == false)
                {
                    using (MutexObject.section(m))
                    {
                        try
                        {
                            perform();
                        }
                        catch (Exception e)
                        {
                            Gnd.i.logger.writeLine("EngineTh error: " + e);

                            doInvoke(delegate
                            {
                                FaultOperation.caught(e);
                            });

                            Gnd.i.logger.writeLine("EngineTh MBoxラッシュ回避 wait start");

                            for (int c = 0; c < 15 && death == false; c++)                             // MBoxラッシュ回避
                            {
                                Thread.Sleep(2000);
                            }

                            Gnd.i.logger.writeLine("EngineTh MBoxラッシュ回避 wait end");
                        }
                    }
                    Thread.Sleep(100);
                }
            });
            th.Start();

            Gnd.i.logger.writeLine("EngineTh started");
        }
コード例 #3
0
 private static void main2(string[] args)
 {
     using (MutexObject mo = new MutexObject(APP_IDENT))
     {
         if (mo.waitForMillis(0))
         {
             try
             {
                 main3();
             }
             catch (Exception e)
             {
                 FailedOperation.caught(e);
             }
             mo.release();
         }
     }
 }