CVS update: php31/sapi

From: Date: Fri, 28 Aug 1998 20:35:43 +0000
Subject: CVS update: php31/sapi
Groups: php.dev 
Request: Send a blank email to php-dev+get-646@lists.php.net to get a copy of this message
Date: Friday August 28, 1998 @ 16:35 Author: shane Update of /repository/php31/sapi In directory asf:/u2/tmp/cvs-serv14420/sapi Modified Files: apache_sapi.c isapi_sapi.c nsapi_sapi.c wsapi_sapi.c Log Message: fix some major threading issues in our dl functions. odbc was loading m$ odbc dlls which created new threads, and calling our dllmain which would then initialize php all over. A LOT of overhead is now gone. Still trying to figure out why certain odbc support dlls are getting loaded with each hit, even though were no longer calling dlopen on each thread. Also fixes to scanners for my flex fix Index: php31/sapi/apache_sapi.c diff -c php31/sapi/apache_sapi.c:2.13 php31/sapi/apache_sapi.c:2.14 *** php31/sapi/apache_sapi.c:2.13 Sun Aug 23 02:29:13 1998 --- php31/sapi/apache_sapi.c Fri Aug 28 16:35:42 1998 *************** *** 584,590 **** return _php3_sapi_process_start(module_info); break; case DLL_THREAD_ATTACH: ! return _php3_sapi_thread_start(module_info); break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); --- 584,595 ---- return _php3_sapi_process_start(module_info); break; case DLL_THREAD_ATTACH: ! /* often support dll's will start new threads that we do not want ! initialized for php (because they don't need it, so we avoid ! overhead). We are checking inside php3_sapi_main for tls allocation, ! and if not, starting the thread there. ! return _php3_sapi_thread_start(module_info); */ ! return TRUE; break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); Index: php31/sapi/isapi_sapi.c diff -c php31/sapi/isapi_sapi.c:2.17 php31/sapi/isapi_sapi.c:2.18 *** php31/sapi/isapi_sapi.c:2.17 Tue Aug 25 14:35:53 1998 --- php31/sapi/isapi_sapi.c Fri Aug 28 16:35:43 1998 *************** *** 181,197 **** /* if we're sending a location header... */ switch (sapi_info->http_redirect) { case 1: req = HSE_REQ_SEND_URL_REDIRECT_RESP; headlen = strlen(sapi_info->httpstatus); /*for some reason, if we actualy print something on a redirection, iis does very funky stuff*/ php3_globals->client_alive=0; break; ! case 2: req = HSE_REQ_SEND_URL; headlen = strlen(sapi_info->httpstatus); php3_globals->client_alive=0; ! break; default: req = HSE_REQ_SEND_RESPONSE_HEADER; if (sapi_info->headers) { --- 181,198 ---- /* if we're sending a location header... */ switch (sapi_info->http_redirect) { case 1: + case 2: req = HSE_REQ_SEND_URL_REDIRECT_RESP; headlen = strlen(sapi_info->httpstatus); /*for some reason, if we actualy print something on a redirection, iis does very funky stuff*/ php3_globals->client_alive=0; break; ! /* case 2: req = HSE_REQ_SEND_URL; headlen = strlen(sapi_info->httpstatus); php3_globals->client_alive=0; ! break;*/ default: req = HSE_REQ_SEND_RESPONSE_HEADER; if (sapi_info->headers) { *************** *** 212,217 **** --- 213,220 ---- req, sapi_info->httpstatus, &headlen, (LPDWORD) tempstr)) { /*FIXME request_shutdown on failure! */ + if (sapi_info->httpstatus) + efree(sapi_info->httpstatus); if (tempstr) efree(tempstr); #if defined(CRASH_DETECTION) *************** *** 221,226 **** --- 224,231 ---- } if (tempstr) efree(tempstr); + if (sapi_info->httpstatus) + efree(sapi_info->httpstatus); } return SUCCESS; } *************** *** 539,550 **** DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: return _php3_sapi_process_start(module_info); break; case DLL_THREAD_ATTACH: ! return _php3_sapi_thread_start(module_info); break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); --- 544,561 ---- DWORD ul_reason_for_call, LPVOID lpReserved) { + __try{ switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: return _php3_sapi_process_start(module_info); break; case DLL_THREAD_ATTACH: ! /* often support dll's will start new threads that we do not want ! initialized for php (because they don't need it, so we avoid ! overhead). We are checking inside php3_sapi_main for tls allocation, ! and if not, starting the thread there. ! return _php3_sapi_thread_start(module_info); */ ! return TRUE; break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); *************** *** 553,558 **** --- 564,578 ---- return _php3_sapi_process_end(); break; } + } __except(EXCEPTION_EXECUTE_HANDLER) { + #if DEBUG + char logmessage[80]; + snprintf(logmessage, 79, "%d:isapi_dllmain exception\n", GetCurrentThreadId()); + OutputDebugString(logmessage); + #endif + return FALSE; + } + return FALSE; } Index: php31/sapi/nsapi_sapi.c diff -c php31/sapi/nsapi_sapi.c:2.8 php31/sapi/nsapi_sapi.c:2.9 *** php31/sapi/nsapi_sapi.c:2.8 Thu Aug 27 16:55:48 1998 --- php31/sapi/nsapi_sapi.c Fri Aug 28 16:35:43 1998 *************** *** 667,673 **** return _php3_sapi_process_start(module_info); break; case DLL_THREAD_ATTACH: ! return _php3_sapi_thread_start(module_info); break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); --- 667,678 ---- return _php3_sapi_process_start(module_info); break; case DLL_THREAD_ATTACH: ! /* often support dll's will start new threads that we do not want ! initialized for php (because they don't need it, so we avoid ! overhead). We are checking inside php3_sapi_main for tls allocation, ! and if not, starting the thread there. ! return _php3_sapi_thread_start(module_info); */ ! return TRUE; break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); Index: php31/sapi/wsapi_sapi.c diff -c php31/sapi/wsapi_sapi.c:2.5 php31/sapi/wsapi_sapi.c:2.6 *** php31/sapi/wsapi_sapi.c:2.5 Fri Aug 28 00:09:39 1998 --- php31/sapi/wsapi_sapi.c Fri Aug 28 16:35:43 1998 *************** *** 494,500 **** return(bind_wsapi(MAJOR_VERSION, MINOR_VERSION, FALSE)); break; case DLL_THREAD_ATTACH: ! return _php3_sapi_thread_start(module_info); break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); --- 494,505 ---- return(bind_wsapi(MAJOR_VERSION, MINOR_VERSION, FALSE)); break; case DLL_THREAD_ATTACH: ! /* often support dll's will start new threads that we do not want ! initialized for php (because they don't need it, so we avoid ! overhead). We are checking inside php3_sapi_main for tls allocation, ! and if not, starting the thread there. ! return _php3_sapi_thread_start(module_info); */ ! return TRUE; break; case DLL_THREAD_DETACH: return _php3_sapi_thread_end(); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#646) next »