示例#1
0
        protected void OnOverflow(int mertek)
        {
            /*if (this.Overflow != null)
             * {
             *  // masik szal
             *  Overflow(this, new OverflowEventArgs(mertek));
             *  // jobb: EventArgs.Empty
             *  // new EventArgs()
             * }*/
            // immputable: Delagate, MulticastDelegate
            //OverflowHandler temp = this.Overflow;
            // thread safe atomic muveletek
            OverflowHandler temp = Interlocked.CompareExchange(ref this.Overflow, null, null);

            // Interlocked.CompareExchange(ref a, b, c)
            // old=a; if(a==c) a=b; return old;

            /*long a = 500;
             * a += 1000; */
            if (temp != null)
            {
                temp(this, new OverflowEventArgs(mertek));
            }
        }
示例#2
0
文件: TIMA.cs 项目: Zindre17/GameBoi
 public TIMA(OverflowHandler handler) : base()
 {
     OnOverflow += handler;
 }