return areas and THR stuff. Use struct thread intern instead.
p4raw-id: //depot/ansiperl@335
* we have to roll our own.
*/
+#ifdef USE_THREADS
+#ifdef USE_DECLSPEC_THREAD
__declspec(thread) char strerror_buffer[512];
+#else
+#define strerror_buffer (thr->i.Wstrerror_buffer)
+#endif
+#else
+char strerror_buffer[512];
+#endif
DllExport char *
win32_strerror(int e)
DWORD source = 0;
if(e < 0 || e > sys_nerr) {
+ dTHR;
if(e < 0)
e = GetLastError();
#endif
-
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define win32_strip_return(sv) NOOP
#endif
+/*
+ * Now Win32 specific per-thread data stuff
+ */
+
+#ifdef USE_THREADS
+#ifndef USE_DECLSPEC_THREAD
+#define HAVE_THREAD_INTERN
+
+struct thread_intern
+{
+ char Wstrerror_buffer[512];
+ struct servent Wservent;
+};
+#endif
+#endif
+
#endif /* _INC_WIN32_PERL5 */
struct servent*s,
const char *proto);
+#ifdef USE_THREADS
+#ifdef USE_DECLSPEC_THREAD
__declspec(thread) struct servent myservent;
+#else
+#define myservent (thr->i.Wservent)
+#endif
+#else
+static struct servent myservent;
+#endif
+
static int wsock_started = 0;
void
win32_getservbyname(const char *name, const char *proto)
{
struct servent *r;
-
+ dTHR;
+
SOCKET_TEST(r = getservbyname(name, proto), NULL);
if (r) {
r = win32_savecopyservent(&myservent, r, proto);
win32_getservbyport(int port, const char *proto)
{
struct servent *r;
+ dTHR;
SOCKET_TEST(r = getservbyport(port, proto), NULL);
if (r) {
}
void
+Perl_init_thread_intern(struct perl_thread *thr)
+{
+#ifdef USE_THREADS
+#ifndef USE_DECLSPEC_THREAD
+
+ /*
+ * Initialize port-specific per-thread data in thr->i
+ * as only things we have there are just static areas for
+ * return values we don't _need_ to do anything but
+ * this is good practice:
+ */
+ memset(&thr->i,0,sizeof(thr->i));
+
+#endif
+#endif
+}
+
+void
Perl_set_thread_self(struct perl_thread *thr)
{
#ifdef USE_THREADS
void Perl_set_thread_self _((struct perl_thread *thr));
struct perl_thread *Perl_getTHR _((void));
void Perl_setTHR _((struct perl_thread *t));
+void Perl_init_thread_intern _((struct perl_thread *t));
END_EXTERN_C