Changeset 494

Show
Ignore:
Timestamp:
03/28/08 20:10:47 (9 months ago)
Author:
chris
Message:

Try to make Mika behave like SE RI wrt stopping when the main thread
terminates, even if there is another thread wait()ing on it <shrug>.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Mika/trunk/core-vm/java/java/lang/Thread.java

    r261 r494  
     1/************************************************************************** 
     2* Parts copyright (c) 2001 by Punch Telematix. All rights reserved.       * 
     3* Parts copyright (c) 2007, 2008 by Chris Gray, /k/ Embedded Java         * 
     4* Solutions. All rights reserved.                                         * 
     5*                                                                         * 
     6* Redistribution and use in source and binary forms, with or without      * 
     7* modification, are permitted provided that the following conditions      * 
     8* are met:                                                                * 
     9* 1. Redistributions of source code must retain the above copyright       * 
     10*    notice, this list of conditions and the following disclaimer.        * 
     11* 2. Redistributions in binary form must reproduce the above copyright    * 
     12*    notice, this list of conditions and the following disclaimer in the  * 
     13*    documentation and/or other materials provided with the distribution. * 
     14* 3. Neither the name of Punch Telematix or of /k/ Embedded Java Solutions* 
     15*    nor the names of other contributors may be used to endorse or promote* 
     16*    products derived from this software without specific prior written   * 
     17*    permission.                                                          * 
     18*                                                                         * 
     19* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED          * 
     20* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF    * 
     21* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.    * 
     22* IN NO EVENT SHALL PUNCH TELEMATIX, /K/ EMBEDDED JAVA SOLUTIONS OR OTHER * 
     23* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,   * 
     24* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,     * 
     25* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR      * 
     26* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  * 
     27* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING    * 
     28* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS      * 
     29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.            * 
     30**************************************************************************/ 
     31 
    132/************************************************************************** 
    233* Copyright (c) 2001, 2002, 2003 by Acunia N.V. All rights reserved.      * 
     
    284315 
    285316  /** 
    286    * * _run() is the method which is used to define the initial frame * when 
    287    * create() is called. When a thread is started using start(), * the result is 
    288    * to execute run() and then (when _run() terminates) * to send a termination 
    289    * request to the ThreadGroup manager. 
     317   * _run() is the method which is used to define the initial stack frame.  
    290318   */ 
    291319  void _run() { 
     
    302330      parent = null; 
    303331      synchronized (this) { 
    304         if (state_lock == null) { 
    305           state_lock = new Object(); 
    306         } 
     332        // [CG 20080131] 
     333        // Emulate behaviour of Sun's VM, in which returning from run() seems 
     334        // to cause a wait() on the Thread to complete. 
     335        notifyAll(); 
    307336      } 
    308337      synchronized (state_lock) { 
     
    568597   */ 
    569598  public final boolean isAlive() { 
    570     synchronized(this) { 
    571       if (state_lock == null) { 
    572         state_lock = new Object(); 
    573       } 
    574     } 
    575     synchronized (state_lock) { 
    576       return started && !stopped; 
    577     } 
    578   } 
    579  
     599    return started && !stopped; 
     600  } 
    580601 
    581602  /** 
  • Mika/trunk/core-vm/java/java/lang/ThreadGroup.java

    r212 r494  
    11/************************************************************************** 
    2 * Copyright  (c) 2001 by Acunia N.V. All rights reserved.                 * 
     2* Parts copyright (c) 2001 by Punch Telematix. All rights reserved.       * 
     3* Parts copyright (c) 2007 by Chris Gray, /k/ Embedded Java Solutions.    * 
     4* All rights reserved.                                                    * 
    35*                                                                         * 
    4 * This software is copyrighted by and is the sole property of Acunia N.V. * 
    5 * and its licensors, if any. All rights, title, ownership, or other       * 
    6 * interests in the software remain the property of Acunia N.V. and its    * 
    7 * licensors, if any.                                                      * 
     6* Redistribution and use in source and binary forms, with or without      * 
     7* modification, are permitted provided that the following conditions      * 
     8* are met:                                                                * 
     9* 1. Redistributions of source code must retain the above copyright       * 
     10*    notice, this list of conditions and the following disclaimer.        * 
     11* 2. Redistributions in binary form must reproduce the above copyright    * 
     12*    notice, this list of conditions and the following disclaimer in the  * 
     13*    documentation and/or other materials provided with the distribution. * 
     14* 3. Neither the name of Punch Telematix or of /k/ Embedded Java Solutions* 
     15*    nor the names of other contributors may be used to endorse or promote* 
     16*    products derived from this software without specific prior written   * 
     17*    permission.                                                          * 
    818*                                                                         * 
    9 * This software may only be used in accordance with the corresponding     * 
    10 * license agreement. Any unauthorized use, duplication, transmission,     * 
    11 *  distribution or disclosure of this software is expressly forbidden.    * 
    12 *                                                                         * 
    13 * This Copyright notice may not be removed or modified without prior      * 
    14 * written consent of Acunia N.V.                                          * 
    15 *                                                                         * 
    16 * Acunia N.V. reserves the right to modify this software without notice.  * 
    17 *                                                                         * 
    18 *   Acunia N.V.                                                           * 
    19 *   Vanden Tymplestraat 35      info@acunia.com                           * 
    20 *   3000 Leuven                 http://www.acunia.com                     * 
    21 *   Belgium - EUROPE                                                      * 
    22 *                                                                         * 
    23 * Mika(TM) modifications Copyright (C) 2004, 2005 Chris Gray,             * 
    24 * /k/ Embedded Java Solutions.  All rights reserved.                      * 
    25 *                                                                         * 
     19* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED          * 
     20* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF    * 
     21* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.    * 
     22* IN NO EVENT SHALL PUNCH TELEMATIX, /K/ EMBEDDED JAVA SOLUTIONS OR OTHER * 
     23* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,   * 
     24* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,     * 
     25* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR      * 
     26* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  * 
     27* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING    * 
     28* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS      * 
     29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.            * 
    2630**************************************************************************/ 
    27  
    28  
    29 /* 
    30 ** $Id: ThreadGroup.java,v 1.7 2006/03/29 09:27:14 cvs Exp $ 
    31 */ 
    3231 
    3332package java.lang;