summaryrefslogtreecommitdiff
path: root/win32/perllib.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-29 04:53:00 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-29 04:53:00 +0000
commitba869debd80c55cfae8e9d4de0991d62f9efcb9b (patch)
tree73f5810de88203f0df413aee0bc7f3c94d686329 /win32/perllib.c
parentd5c3ff09f505a33428a0772c6e16c91e1df4ce85 (diff)
downloadperl-ba869debd80c55cfae8e9d4de0991d62f9efcb9b.tar.gz
support fetching current interpreter from TLS under useithreads
p4raw-id: //depot/perl@5342
Diffstat (limited to 'win32/perllib.c')
-rw-r--r--win32/perllib.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/win32/perllib.c b/win32/perllib.c
index 26135f864e..3aed2415fd 100644
--- a/win32/perllib.c
+++ b/win32/perllib.c
@@ -160,7 +160,7 @@ perl_construct(PerlInterpreter* my_perl)
CPerlHost* pHost = (CPerlHost*)w32_internal_host;
Perl_free();
delete pHost;
- SetPerlInterpreter(NULL);
+ PERL_SET_THX(NULL);
}
}
@@ -200,7 +200,7 @@ perl_free(PerlInterpreter* my_perl)
{
}
#endif
- SetPerlInterpreter(NULL);
+ PERL_SET_THX(NULL);
}
EXTERN_C int
@@ -254,26 +254,6 @@ perl_parse(PerlInterpreter* my_perl, void (*xsinit)(CPerlObj*), int argc, char**
EXTERN_C HANDLE w32_perldll_handle;
-static DWORD g_TlsAllocIndex;
-
-EXTERN_C DllExport bool
-SetPerlInterpreter(void *interp)
-{
- DWORD dwErr = GetLastError();
- bool bResult = TlsSetValue(g_TlsAllocIndex, interp);
- SetLastError(dwErr);
- return bResult;
-}
-
-EXTERN_C DllExport void*
-GetPerlInterpreter(void)
-{
- DWORD dwErr = GetLastError();
- LPVOID pResult = TlsGetValue(g_TlsAllocIndex);
- SetLastError(dwErr);
- return pResult;
-}
-
EXTERN_C DllExport int
RunPerl(int argc, char **argv, char **env)
{
@@ -333,7 +313,7 @@ RunPerl(int argc, char **argv, char **env)
new_perl = perl_clone(my_perl, 1);
# endif
exitstatus = perl_run( new_perl );
- SetPerlInterpreter(my_perl);
+ PERL_SET_THX(my_perl);
#else
exitstatus = perl_run( my_perl );
#endif
@@ -343,7 +323,7 @@ RunPerl(int argc, char **argv, char **env)
perl_free( my_perl );
#ifdef USE_ITHREADS
if (new_perl) {
- SetPerlInterpreter(new_perl);
+ PERL_SET_THX(new_perl);
perl_destruct(new_perl);
perl_free(new_perl);
}
@@ -371,7 +351,6 @@ DllMain(HANDLE hModule, /* DLL module handle */
setmode( fileno( stderr ), O_BINARY );
_fmode = O_BINARY;
#endif
- g_TlsAllocIndex = TlsAlloc();
DisableThreadLibraryCalls((HMODULE)hModule);
w32_perldll_handle = hModule;
break;
@@ -380,7 +359,6 @@ DllMain(HANDLE hModule, /* DLL module handle */
* process termination or call to FreeLibrary.
*/
case DLL_PROCESS_DETACH:
- TlsFree(g_TlsAllocIndex);
break;
/* The attached process creates a new thread. */