This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SuspendThread failed (win32?)


I was trying to track down a threading problem with a sample class,
but when I run it a popup box says "Fatal error: SuspendThread failed"
(not the problem I was looking for..). This only seems to be on win32
in my (brief) testing.

Any hints on what I might be doing wrong?

win32
gcc version 3.5.0 20040730 (experimental)
or 3.4.1 final

gcj -g --main=ThrTest ThrTest.java -o t1.exe
 
Program received signal SIGSEGV, Segmentation fault.
[Switching to thread 1476.0x12c]
0x0045d9df in GC_mark_from ()
(gdb) bt
#0  0x0045d9df in GC_mark_from ()
#1  0x00000000 in ?? () from
#2  0x0132fc54 in ?? ()


public class ThrTest {

  public int i;

  public static void main(String[] a) {

    ThrTest thrTest = new ThrTest();

    A A1 = thrTest.new A(1, thrTest);
    A A2 = thrTest.new C(2, thrTest);

    try {
      A1.start();
      A2.start();

    } catch (Exception e) {
      e.printStackTrace();
    }

  }

  class C extends B {
    public C(int i, ThrTest thrTest) {
      super(i, thrTest);
    }

    protected void doStuff() {
      super.doStuff();
      for (int j = 0; j > -10000; j--) {
        thrTest.i = j;
        get();
      }
    }
  }

  class B extends A {
    public B(int i, ThrTest thrTest) {
      super(i, thrTest);
    }

    protected void doStuff() {
      super.doStuff();
      for (int j = 0; j < 10000; j++) {
        thrTest.i = j;
        get();
      }
    }
  }

  class A extends Thread {

    ThrTest thrTest;
    int i;

    public A(int i, ThrTest thrTest) {
      this.thrTest = thrTest;
      this.i = i;
    }

    public void get() {
      System.out.println(i + " : " + thrTest.i);
    }

    protected void doStuff() {
    }

    public void run() {

      while (true) {
        synchronized (this) {
          doStuff();
          get();
        }
      }
    }

  }

}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]