Welcome to mirror list, hosted at ThFree Co, Russian Federation.

perthread.h « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa6e1dfcbe0e7be3798218a4e615a6e6130d84d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
}