Przeglądaj źródła

Enabled threaded support.

woollybah 10 lat temu
rodzic
commit
27827086a7
3 zmienionych plików z 4 dodań i 21 usunięć
  1. 1 1
      blitz.mod/blitz.bmx
  2. 3 3
      blitz.mod/blitz_app.c
  3. 0 17
      blitz.mod/blitz_thread.c

+ 1 - 1
blitz.mod/blitz.bmx

@@ -73,7 +73,7 @@ Import "blitz_array.c"
 Import "blitz_handle.c"
 Import "blitz_debug.c"
 Import "blitz_incbin.c"
-'Import "blitz_thread.c"
+Import "blitz_thread.c"
 Import "blitz_ex.c"
 Import "blitz_gc.c"
 

+ 3 - 3
blitz.mod/blitz_app.c

@@ -246,7 +246,7 @@ void bbStartup( int argc,char *argv[],void *dummy1,void *dummy2 ){
 	
 	//bbGCStackTop=ebp+28;
 	
-	// BaH bbThreadStartup();
+	bbThreadStartup();
 	bbGCStartup();
 
 	if( GetVersionEx( &os ) ){
@@ -319,7 +319,7 @@ void bbStartup( int argc,char *argv[],void *dummy1,void *dummy2 ){
 	
 	bbGCStackTop=ebp+28;
 	
-	// BaH bbThreadStartup();
+	bbThreadStartup();
 	bbGCStartup();
 	
 	getcwd( buf,PATH_MAX );
@@ -357,7 +357,7 @@ void bbStartup( int argc,char *argv[],void *dummy1,void *dummy2 ){
 	bbGCStackTop=&argc;
 //#endif
 
-	// BaH bbThreadStartup();
+	bbThreadStartup();
 	bbGCStartup();
 	
 	getcwd( buf,PATH_MAX );

+ 0 - 17
blitz.mod/blitz_thread.c

@@ -123,10 +123,6 @@ BBThread *bbThreadCreate( BBThreadProc proc,BBObject *data ){
 	thread->detached=0;
 	thread->handle=CreateThread( 0,0,threadProc,thread,CREATE_SUSPENDED,&thread->id );
 
-	CONTEXT ctx={CONTEXT_CONTROL};
-	GetThreadContext( thread->handle,&ctx );
-	thread->stackTop=ctx.Esp;
-
 	BB_LOCK
 	addThread( thread );
 	BB_UNLOCK
@@ -179,16 +175,6 @@ BBThread *_bbThreadLockThreads(){
 	for( t=threads;t;t=t->succ ){
 		if( t!=curThread ){
 			SuspendThread( t->handle );
-			CONTEXT ctx={CONTEXT_INTEGER|CONTEXT_CONTROL};
-			GetThreadContext( t->handle,&ctx );
-			t->locked_regs[0]=ctx.Edi;
-			t->locked_regs[1]=ctx.Esi;
-			t->locked_regs[2]=ctx.Ebx;
-			t->locked_regs[3]=ctx.Edx;
-			t->locked_regs[4]=ctx.Ecx;
-			t->locked_regs[5]=ctx.Eax;
-			t->locked_regs[6]=ctx.Ebp;
-			t->locked_sp=ctx.Esp;
 		}
 	}
 	return threads;
@@ -224,8 +210,6 @@ static pthread_key_t curThreadTls;
 static void suspendSigHandler( int sig ){//,siginfo_t *info,ucontext_t *ctx ){
 	BBThread *thread=pthread_getspecific( curThreadTls );
 	
-	thread->locked_sp=bbGCRootRegs( thread->locked_regs );
-	
 #ifdef DEBUG_THREADS
 	printf( "In suspendSigHandler! thread=%p locked_sp=%p\n",thread,thread->locked_sp );fflush( stdout );
 #endif
@@ -277,7 +261,6 @@ void bbThreadStartup(){
 static void *threadProc( void *p ){
 	BBThread *thread=p;
 	
-	thread->stackTop=bbGCRootRegs( thread->locked_regs );
 	pthread_setspecific( curThreadTls,thread );
 	
 	BB_LOCK