changeset 88:c1370f669734

Added InitThread and DeinitThread methods for locking go routines to an OS thread and setting them up for Dynamic Windows calls.... then shutting down Dynamic Windows for the thread and unlocking it.
author Brian Smith <brian@dbsoft.org>
date Tue, 10 Sep 2013 03:54:16 -0500
parents 4c8683490c14
children 90e3c9c7ac73
files src/dw/dw.go
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dw/dw.go	Fri Aug 30 04:17:49 2013 -0500
+++ b/src/dw/dw.go	Tue Sep 10 03:54:16 2013 -0500
@@ -821,6 +821,20 @@
     return int(C.go_init(C.int(newthread), 0, nil));
 }
 
+// Initializes a Go Routine for Dynamic Windows calls
+func InitThread() {
+   runtime.LockOSThread();
+   
+   C._dw_init_thread();
+}
+
+// Deinitializes a Go Routine when Dyamic Windows calls are complete
+func DeinitThread() {   
+   C._dw_deinit_thread();
+
+   runtime.UnlockOSThread();
+}
+
 // Cleanly terminates a DW session, should be signal handler safe but does not exit.
 func Shutdown() {
     C.dw_shutdown();