001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.scheduler;
014
015import org.vmmagic.pragma.Interruptible;
016import org.vmmagic.pragma.NonMoving;
017import org.vmmagic.pragma.Uninterruptible;
018
019/**
020 */
021@Uninterruptible
022@NonMoving
023public abstract class SystemThread {
024
025  protected final RVMThread rvmThread;
026
027  protected SystemThread(String name) {
028    rvmThread = new RVMThread(this, name);
029    rvmThread.makeDaemon(true);
030  }
031
032  protected SystemThread(byte[] stack, String name) {
033    rvmThread = new RVMThread(this, stack, name);
034    rvmThread.makeDaemon(true);
035  }
036
037  public RVMThread getRVMThread() {
038    return rvmThread;
039  }
040
041  @Interruptible
042  public void start() {
043    rvmThread.start();
044  }
045
046  public void stop(Throwable cause) {
047    rvmThread.stop(cause);
048  }
049
050  @Interruptible
051  public abstract void run();
052}