Example #1
0
        /*Mutex.WaitOne(TimeSpan, Boolean)封鎖目前的執行緒,直到目前的執行個體收到通知為止;
         * 使用 TimeSpan 來測量時間間隔,並指定要不要在等候之前先離開同步領域。*/
        /// <summary>
        /// 判断是否被锁定
        /// </summary>
        /// <returns></returns>
        private static bool IsFirstInstance()
        {
            // create a new instance of the Mutex class ..
            __Mu = new global::System.Threading.Mutex(false, AssemblyInfoClass.GuidInfo);

            //检查当前线程是否被锁定 check current thread whether were locking ..
            if (__Mu.WaitOne(TimeSpan.Zero, false))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public override object __hx_setField(string field, int hash, object @value, bool handleProperties)
        {
            unchecked {
                                #line 27 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\thread\\Mutex.hx"
                switch (hash)
                {
                case 572311959:
                {
                                                #line 27 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\thread\\Mutex.hx"
                    this.native = ((global::System.Threading.Mutex)(@value));
                                                #line 27 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\thread\\Mutex.hx"
                    return(@value);
                }


                default:
                {
                                                #line 27 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\sys\\thread\\Mutex.hx"
                    return(base.__hx_setField(field, hash, @value, handleProperties));
                }
                }
            }
                        #line default
        }