tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/server/isapi jk_isapi_plugin.c
Date Thu, 04 Jul 2002 07:23:55 GMT
mturk       2002/07/04 00:23:55

  Modified:    jk/native2/server/isapi jk_isapi_plugin.c
  Log:
  Set the starter thread extisting through entire extension life cycle.
  The starter thread at init sleeps for 1 s, causing not blocking of
  the main IIS thread that calls LoadLibrary for our extension.
  
  Revision  Changes    Path
  1.32      +26 -6     jakarta-tomcat-connectors/jk/native2/server/isapi/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/isapi/jk_isapi_plugin.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- jk_isapi_plugin.c	1 Jul 2002 16:53:55 -0000	1.31
  +++ jk_isapi_plugin.c	4 Jul 2002 07:23:55 -0000	1.32
  @@ -520,8 +520,13 @@
       return TerminateFilter(dwFlags);
   }
   
  +HANDLE jk2_starter_event;
  +
   BOOL WINAPI TerminateFilter(DWORD dwFlags) 
   {
  +    /* detatch the starter thread */
  +    SetEvent(jk2_starter_event);
  +
       if (is_inited) {
           is_inited = JK_FALSE;
           if (workerEnv) {
  @@ -540,11 +545,14 @@
   
   DWORD WINAPI jk2_isapi_starter( LPVOID lpParam ) 
   { 
  +    Sleep(1000);
  +    
       initialize_extension();
       if (is_inited) {
           if (init_jk(NULL))
               is_mapread = JK_TRUE;
       }
  +    WaitForSingleObject(jk2_starter_event, INFINITE);
       return 0; 
   } 
   
  @@ -558,21 +566,33 @@
       char dir[_MAX_DIR];
       char fname[_MAX_FNAME];
       DWORD dwThreadId;
  +    DWORD dwRes;
  +    int tcount = 0;
   
       switch (ulReason) {
           case DLL_PROCESS_DETACH:
  -            __try {
  -                if (jk2_starter_thread)
  -                    CloseHandle(jk2_starter_thread);
  -                TerminateFilter(HSE_TERM_MUST_UNLOAD);
  -            } __except(1) {
  +            while (!GetExitCodeThread(jk2_starter_thread, &dwRes)) {
  +                if (dwRes == STILL_ACTIVE) {
  +                    ++tcount;
  +                    if (tcount > 30) {
  +                        TerminateThread(jk2_starter_thread, -1);
  +                        break;
  +                    }
  +                    Sleep(100);
  +                }
               }
  +            CloseHandle(jk2_starter_thread);
           break;
   
           case DLL_PROCESS_ATTACH:
               if (GetModuleFileName( hInst, file_name, sizeof(file_name))) {
                   _splitpath( file_name, drive, dir, fname, NULL );
                   _makepath( ini_file_name, drive, dir, fname, ".properties" );
  +                
  +                jk2_starter_event = CreateEvent(NULL,
  +                                                FALSE,
  +                                                FALSE,
  +                                                NULL);
   
                   jk2_starter_thread = CreateThread( NULL,
                                           0,
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message