Changeset 9292


Ignore:
Timestamp:
Apr 26, 2008, 7:47:35 PM (11 years ago)
Author:
gb
Message:

use _beginthreadex(), which allegedly avoids some memory leaks in the
C runtime.

conditionalize use of pthreads stuff in lisp_thread_entry(). Still
need a way to get a windows thread to clean up after itself when terminated
.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/win64/lisp-kernel/thread_manager.c

    r9236 r9292  
    949949#endif
    950950#ifdef WINDOWS
    951           GetCurrentThread()
     951          GetCurrentThreadId()
    952952#endif
    953953          );
     
    11001100
    11011101
    1102 #ifdef WINDOWS
    1103 lisp_thread_entry(void *param)
    1104 {
    1105 }
    1106 #else
    11071102void *
    11081103lisp_thread_entry(void *param)
    11091104{
    11101105  thread_activation *activation = (thread_activation *)param;
    1111   TCR *tcr = new_tcr(activation->vsize, activation->vsize);
     1106  TCR *tcr = new_tcr(activation->vsize, activation->tsize);
     1107#ifndef WINDOWS
    11121108  sigset_t mask, old_mask;
    11131109
    11141110  sigemptyset(&mask);
    11151111  pthread_sigmask(SIG_SETMASK, &mask, &old_mask);
     1112#endif
    11161113
    11171114  register_thread_tcr(tcr);
    11181115
     1116#ifndef WINDOWS
    11191117  pthread_cleanup_push(tcr_cleanup,(void *)tcr);
     1118#endif
    11201119  tcr->vs_area->active -= node_size;
    11211120  *(--tcr->save_vsp) = lisp_nil;
     
    11301129    start_lisp(TCR_TO_TSD(tcr),0);
    11311130  } while (tcr->flags & (1<<TCR_FLAG_BIT_AWAITING_PRESET));
     1131#ifndef WINDOWS
    11321132  pthread_cleanup_pop(true);
    1133 
    1134 }
    1135 #endif
     1133#else
     1134  tcr_cleanup();
     1135#endif
     1136
     1137}
    11361138
    11371139void *
     
    12161218{
    12171219  HANDLE thread_handle;
    1218   ULONG thread_id;
    1219 
    1220   /* what about stackaddr? */
    1221   thread_handle = CreateThread(NULL, stack_size, start_routine,
    1222                                param, 0, &thread_id);
     1220
     1221  thread_handle = (HANDLE)_beginthreadex(NULL,
     1222                                        stack_size,
     1223                                        start_routine,
     1224                                        param,
     1225                                        0,
     1226                                        NULL);
    12231227
    12241228  if (thread_handle == NULL) {
Note: See TracChangeset for help on using the changeset viewer.