|
@@ -89,7 +89,15 @@ enum ThreadState { ready, running, suspended, finished }
|
|
|
|
|
|
|
|
class ThreadedVM extends VM {
|
|
class ThreadedVM extends VM {
|
|
|
ThreadState get state => ThreadState.values[_Bindings.pkpy_tvm_get_state(pointer)];
|
|
ThreadState get state => ThreadState.values[_Bindings.pkpy_tvm_get_state(pointer)];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @override
|
|
|
|
|
+ void dispose() {
|
|
|
|
|
+ terminate();
|
|
|
|
|
+ Future.delayed(Duration(milliseconds: 150)).then((_) => _Bindings.pkpy_delete(pointer));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/// Run a given source on a threaded virtual machine. The excution will be started in a new thread.
|
|
/// Run a given source on a threaded virtual machine. The excution will be started in a new thread.
|
|
|
void exec_async(String source)
|
|
void exec_async(String source)
|
|
|
{
|
|
{
|