!747 !1001362 // named thread m { static boolean free = true; static new L programsStarted; static class PaA { S progID; S[] arguments; *(S *progID, S[] *arguments) {} *() {} } p { makeAndroid3("A multi-program VM. PID: " + getPID()); sleep(); } static synchronized S answer(S s, L history) { new Matches m; if (match3("please start program *", s, m)) { if (!free) ret "Sorry, not free."; final S progID = formatSnippetID(unquote(m.m[0])); final S[] arguments = new S[0]; programsStarted.add(new PaA(progID, arguments)); // better call JavaX for translation in a single thread. final Class theClass = hotwire(progID); // program may run in its own thread. thread progID { callMain(theClass, arguments); } ret "OK."; } if (match3("are you free to start a program?", s)) ret free ? "Yes." : "No."; // free is usually true, but may be set to false by someone to stop this VM from starting more programs. if (match3("list programs started", s)) ret structure(programsStarted); ret null; } }