01: /*
02: * @(#)currentThread.java 1.2 04/12/06
03: *
04: * Copyright (c) 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package org.pnuts.multithread;
10:
11: import pnuts.lang.Context;
12: import pnuts.lang.PnutsFunction;
13:
14: public class currentThread extends PnutsFunction {
15:
16: public currentThread() {
17: super ("currentThread");
18: }
19:
20: public boolean defined(int narg) {
21: return (narg == 0);
22: }
23:
24: protected Object exec(Object args[], Context context) {
25: if (args.length != 0) {
26: undefined(args, context);
27: return null;
28: }
29: return Thread.currentThread();
30: }
31:
32: public String toString() {
33: return "function currentThread()";
34: }
35: }
|