Changeset 546


Ignore:
Timestamp:
Feb 15, 2004, 8:25:55 AM (21 years ago)
Author:
Gary Byers
Message:

Foreign threads linger, too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/thread_manager.c

    r471 r546  
    446446  area *vs, *ts, *cs;
    447447
    448   if (tcr->flags & (1<<TCR_FLAG_BIT_FOREIGN)) {
    449     TCR *current_tls = tsd_get(lisp_global(TCR_KEY));
    450     LispObj callback_macptr = nrs_FOREIGN_THREAD_CONTROL.vcell,
    451       callback_ptr = ((macptr *)(untag(callback_macptr)))->address;
     448 
     449  if (--(tcr->shutdown_count) == 0) {
     450    if (tcr->flags & (1<<TCR_FLAG_BIT_FOREIGN)) {
     451      LispObj callback_macptr = nrs_FOREIGN_THREAD_CONTROL.vcell,
     452        callback_ptr = ((macptr *)(untag(callback_macptr)))->address;
    452453   
    453     tsd_set(lisp_global(TCR_KEY), tcr);
    454     ((void (*)())callback_ptr)(1);
    455     tsd_set(lisp_global(TCR_KEY),current_tls);
    456   }
    457  
    458   if (--(tcr->shutdown_count) == 0) {
    459 #ifdef DEBUG_THREAD_CLEANUP
    460     fprintf(stderr, "\nprocessing final shutdown request for pthread 0x%x tcr 0x%x", pthread_self(), tcr);
    461 #endif
     454      tsd_set(lisp_global(TCR_KEY), tcr);
     455      ((void (*)())callback_ptr)(1);
     456    }
    462457#ifdef DARWIN
    463458    darwin_exception_cleanup(tcr);
     
    486481  } else {
    487482    tsd_set(lisp_global(TCR_KEY), tcr);
    488 #ifdef DEBUG_THREAD_CLEANUP
    489     fprintf(stderr, "\nprocessing early shutdown request for pthread 0x%x tcr 0x%x, tsd = 0x%x",
    490             pthread_self(), tcr, tsd_get(lisp_global(TCR_KEY)));
    491 #endif
    492483  }
    493484}
     
    515506  a = register_cstack((BytePtr)stack_base, stack_size);
    516507  tcr->cs_area = a;
    517   tcr->cs_limit = (LispObj)a->softlimit;
     508  if (!(tcr->flags & (1<<TCR_FLAG_BIT_FOREIGN))) {
     509    tcr->cs_limit = (LispObj)a->softlimit;
     510  }
    518511#ifdef LINUX
    519512  tcr->native_thread_info = current_r2;
Note: See TracChangeset for help on using the changeset viewer.