}
#ifdef USE_ITHREADS
-static DWORD WINAPI
+static THREAD_RET_TYPE
win32_start_child(LPVOID arg)
{
PerlInterpreter *my_perl = (PerlInterpreter*)arg;
id = win32_start_child((LPVOID)new_perl);
PERL_SET_INTERP(aTHXo);
# else
+# ifdef USE_RTL_THREAD_API
+ handle = (HANDLE)_beginthreadex((void*)NULL, 0, win32_start_child,
+ (void*)new_perl, 0, (unsigned*)&id);
+# else
handle = CreateThread(NULL, 0, win32_start_child,
(LPVOID)new_perl, 0, &id);
- PERL_SET_INTERP(aTHXo);
+# endif
+ PERL_SET_INTERP(aTHXo); /* XXX perl_clone*() set TLS */
if (!handle)
Perl_croak(aTHX_ "panic: pseudo fork() failed");
w32_pseudo_child_handles[w32_num_pseudo_children] = handle;
if (child >= 0) {
dTHXo;
CloseHandle(w32_child_handles[child]);
- Copy(&w32_child_handles[child+1], &w32_child_handles[child],
+ Move(&w32_child_handles[child+1], &w32_child_handles[child],
(w32_num_children-child-1), HANDLE);
- Copy(&w32_child_pids[child+1], &w32_child_pids[child],
+ Move(&w32_child_pids[child+1], &w32_child_pids[child],
(w32_num_children-child-1), DWORD);
w32_num_children--;
}
if (child >= 0) {
dTHXo;
CloseHandle(w32_pseudo_child_handles[child]);
- Copy(&w32_pseudo_child_handles[child+1], &w32_pseudo_child_handles[child],
+ Move(&w32_pseudo_child_handles[child+1], &w32_pseudo_child_handles[child],
(w32_num_pseudo_children-child-1), HANDLE);
- Copy(&w32_pseudo_child_pids[child+1], &w32_pseudo_child_pids[child],
+ Move(&w32_pseudo_child_pids[child+1], &w32_pseudo_child_pids[child],
(w32_num_pseudo_children-child-1), DWORD);
w32_num_pseudo_children--;
}
A2WHELPER(filename, wBuffer, sizeof(wBuffer));
wcscpy(wBuffer, PerlDir_mapW(wBuffer));
attrs = GetFileAttributesW(wBuffer);
+ if (attrs == 0xFFFFFFFF)
+ goto fail;
if (attrs & FILE_ATTRIBUTE_READONLY) {
(void)SetFileAttributesW(wBuffer, attrs & ~FILE_ATTRIBUTE_READONLY);
ret = _wunlink(wBuffer);
else {
filename = PerlDir_mapA(filename);
attrs = GetFileAttributesA(filename);
+ if (attrs == 0xFFFFFFFF)
+ goto fail;
if (attrs & FILE_ATTRIBUTE_READONLY) {
(void)SetFileAttributesA(filename, attrs & ~FILE_ATTRIBUTE_READONLY);
ret = unlink(filename);
ret = unlink(filename);
}
return ret;
+fail:
+ errno = ENOENT;
+ return -1;
}
DllExport int