/[dotgnu-pnet]/pnet/libgc/win32_threads.c
ViewVC logotype

Diff of /pnet/libgc/win32_threads.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by ktreichel, Sat Sep 17 16:54:39 2005 UTC revision 1.16 by ktreichel, Mon Oct 10 20:03:15 2005 UTC
# Line 953  BOOL WINAPI DllMain(HINSTANCE inst, ULON Line 953  BOOL WINAPI DllMain(HINSTANCE inst, ULON
953    
954  # endif /* !MSWINCE */  # endif /* !MSWINCE */
955    
956    /*
957     * Run a function under GC control in a thread that was not created
958     * through the gc routines.
959     * (for example by a thrid party library that does a callback).
960     */
961    GC_API void *
962    GC_run_thread(LPTHREAD_START_ROUTINE thread_func,  LPVOID arg)
963    {
964        LPVOID result;
965    
966        /* register the thread */
967    #if defined(GC_DLL) && !defined(CYGWIN32)
968        /* we have nothing to do here because the thread is registered through DllMain */
969    #else
970        GC_ASSERT(GC_thr_initialized);
971        if (GC_main_thread != GetCurrentThreadId()) {
972            GC_new_thread();
973        } /* o.w. we already did it during GC_thr_init(), called by GC_init() */
974    #endif
975        result = thread_func(arg);
976    
977        /* unregister the thread */
978    #if defined(GC_DLL) && !defined(CYGWIN32)
979            /* we have nothing to do here because the thread is will be unregistered */
980        /* through DllMain */
981    #else
982        GC_delete_thread(GetCurrentThreadId());
983    #endif
984        return result;
985    }
986    
987  #endif /* GC_WIN32_THREADS */  #endif /* GC_WIN32_THREADS */

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26