チェンジセット 578

差分発生行の前後
無視リスト:
コミット日時:
2008/06/06 17:12:04 (6 ヶ月前)
コミッタ:
yossy
ログメッセージ:

Thread(soumen): 割り込みハンドラの設定がクリアされていなかったバグ修正

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/Thread/branches/soumen/Thread.as3proj

    r577 r578  
    6969  <!-- Class files to compile (other referenced classes will automatically be included) --> 
    7070  <compileTargets> 
    71     <compile path="samples\autoShowHide\Sample.as" /> 
     71    <compile path="tests\RunTests.as" /> 
    7272  </compileTargets> 
    7373  <!-- Paths to exclude from the Project Explorer tree --> 
  • as3/Thread/branches/soumen/src/org/libspark/thread/Thread.as

    r572 r578  
    757757                        // エラーハンドラをリセット 
    758758                        resetErrorHandlers(); 
     759                        // 割り込みハンドラをリセット 
     760                        _interruptedHandler = null; 
    759761                         
    760762                        // エラーハンドラが実行されようとしている場合、実行終了後に復帰できるように保存しておいた実行関数を設定 
  • as3/Thread/branches/soumen/tests/org/libspark/thread/InterruptionTest.as

    r527 r578  
    9191                                assertEquals('run interrupt interrupted finalize ', Static.log); 
    9292                                assertFalse(i.flag); 
     93                        }, 1000)); 
     94                         
     95                        t.start(); 
     96                } 
     97                 
     98                /** 
     99                 * 割り込みハンドラが実行のたびにリセットされているかどうか 
     100                 */ 
     101                test function clearInterruptedHandler():void 
     102                { 
     103                        Static.log = ''; 
     104                         
     105                        var t:TesterThread = new TesterThread(new ClearInterruptedHandlerTestThread()); 
     106                         
     107                        t.addEventListener(Event.COMPLETE, async(function(e:Event):void 
     108                        { 
     109                                assertEquals('run interrupt runInterrupted interrupt runInterrupted2 finalize ', Static.log); 
    93110                        }, 1000)); 
    94111                         
     
    232249        } 
    233250} 
     251 
     252class ClearInterruptedHandlerTestThread extends Thread 
     253{ 
     254        override protected function run():void 
     255        { 
     256                Static.log += 'run '; 
     257                 
     258                interrupted(runInterrupted); 
     259                wait(); 
     260                 
     261                setTimeout(doInterrupt, 10); 
     262        } 
     263         
     264        private function doInterrupt():void 
     265        { 
     266                Static.log += 'interrupt '; 
     267                 
     268                interrupt(); 
     269        } 
     270         
     271        private function runInterrupted():void 
     272        { 
     273                Static.log += 'runInterrupted '; 
     274                 
     275                error(InterruptedError, runInterrupted2); 
     276                wait(); 
     277                 
     278                setTimeout(doInterrupt, 10); 
     279        } 
     280         
     281        private function runInterrupted2(e:Error, t:Thread):void 
     282        { 
     283                Static.log += 'runInterrupted2 '; 
     284        } 
     285         
     286        override protected function finalize():void 
     287        { 
     288                Static.log += 'finalize '; 
     289        } 
     290}