瀏覽代碼

minor fixes

ncannasse 7 年之前
父節點
當前提交
38c32a0e11
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 4 1
      src/alloc.c
  2. 1 1
      src/debugger.c

+ 4 - 1
src/alloc.c

@@ -206,6 +206,8 @@ static void gc_global_lock( bool lock ) {
 	hl_thread_info *t = current_thread;
 	bool mt = (gc_flags & GC_NO_THREADS) == 0;
 	if( lock ) {
+		if( !t )
+			hl_fatal("Can't lock GC in unregistered thread");
 		if( t->gc_blocking )
 			hl_fatal("Can't lock GC in hl_blocking section");
 		if( mt ) gc_save_context(t);
@@ -1048,7 +1050,8 @@ HL_API bool hl_is_blocking() {
 
 HL_API void hl_blocking( bool b ) {
 	hl_thread_info *t = current_thread;
-	if( !t ) hl_error("Unregistered thread");
+	if( !t )
+		return; // allow hl_blocking in non-GC threads
 	if( b ) {
 #		ifdef HL_THREADS
 		if( t->gc_blocking == 0 )

+ 1 - 1
src/debugger.c

@@ -115,7 +115,7 @@ bool hl_module_debug( hl_module *m, int port, bool wait ) {
 #	ifdef HL_THREADS
 	hl_add_root(&debug_socket);
 	hl_add_root(&client_socket);
-	if( !hl_thread_start(hl_debug_loop, m, false) ) {
+	if( !hl_thread_start(hl_debug_loop, m, true) ) {
 		hl_socket_close(s);
 		return false;
 	}