OSDN Git Service

Forgot perthread.h.
authorcgf <cgf>
Sat, 1 Jul 2000 03:52:33 +0000 (03:52 +0000)
committercgf <cgf>
Sat, 1 Jul 2000 03:52:33 +0000 (03:52 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/perthread.h [new file with mode: 0644]

index 4725a01..1542180 100644 (file)
@@ -30,6 +30,7 @@ Fri Jun 30 23:21:40 2000  Christopher Faylor <cgf@cygnus.com>
        * include/cygwin/version.h: Bump API minor version.
        * binmode.c: New file.
        * textmode.c: Ditto.
+       * perthread.h: Ditto.
        * lib/_cygwin_crt0_common.cc: Ditto.
        * lib/crt0.h: Ditto.
        * lib/cygwin_attach_dll.c: Ditto.
diff --git a/winsup/cygwin/perthread.h b/winsup/cygwin/perthread.h
new file mode 100644 (file)
index 0000000..fa6e1df
--- /dev/null
@@ -0,0 +1,37 @@
+/* perthread.h: Header file for cygwin synchronization primitives.
+
+   Copyright 2000 Cygnus Solutions.
+
+   Written by Christopher Faylor <cgf@cygnus.com>
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#define PTMAGIC 0x77366377
+
+struct _reent;
+extern struct _reent reent_data;
+
+extern DWORD *__stackbase __asm__ ("%fs:4");
+
+extern __inline struct _reent *
+get_reent ()
+{
+  DWORD *base = __stackbase - 1;
+
+  if (*base != PTMAGIC)
+    return &reent_data;
+  return (struct _reent *) base[-1];
+}
+
+extern inline void
+set_reent (struct _reent *r)
+{
+  DWORD *base = __stackbase - 1;
+
+  *base = PTMAGIC;
+  base[-1] = (DWORD) r;
+}