File: os_thread.h

package info (click to toggle)
gambc 4.9.3-1.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 85,424 kB
  • sloc: ansic: 1,047,649; lisp: 243,942; perl: 19,018; sh: 6,385; makefile: 6,303; objc: 3,757; cpp: 2,143; sed: 498; java: 305; awk: 198
file content (107 lines) | stat: -rw-r--r-- 1,900 bytes parent folder | download | duplicates (3)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* File: "os_thread.h" */

/* Copyright (c) 2013-2017 by Marc Feeley, All Rights Reserved. */

#ifndef ___OS_THREAD_H
#define ___OS_THREAD_H

#include "os.h"


/*---------------------------------------------------------------------------*/

#define DECLARE_HASH_MUTEX(name,size) ___MUTEX name[size]

#define HASH_MUTEX_SIZE 67


typedef struct ___thread_module_struct
  {
    int refcount;

#ifdef ___USE_emulated_sync
    DECLARE_HASH_MUTEX(hash_mutex,HASH_MUTEX_SIZE);
#endif

#ifndef ___THREAD_LOCAL_STORAGE_CLASS

#ifdef ___USE_POSIX_THREAD_SYSTEM

  pthread_key_t tls_ptr_key;

#endif

#ifdef ___USE_WIN32_THREAD_SYSTEM

  DWORD tls_ptr_index;

#endif

#ifndef ___USE_POSIX_THREAD_SYSTEM
#ifndef ___USE_WIN32_THREAD_SYSTEM

  /*
   * This fallback only works when there is a single thread.
   * However, this should be the case if none of the supported thread
   * systems is being used.
   */

  void *tls_ptr;

#endif
#endif

#endif
  } ___thread_module;


extern ___thread_module ___thread_mod;


/*---------------------------------------------------------------------------*/


extern ___SCMOBJ ___thread_init_from_self
   ___P((___thread *thread),
        ());

extern ___SCMOBJ ___thread_create
   ___P((___thread *thread),
        ());

extern ___SCMOBJ ___thread_join
   ___P((___thread *thread),
        ());

extern void ___thread_exit ___PVOID;

extern void ___thread_set_pstate
   ___P((___processor_state ___ps),
        ());

#ifdef USE_POSIX

extern int ___thread_sigmask
   ___P((int how,
         ___sigset_type *set,
         ___sigset_type *oldset),
        ());

extern int ___thread_sigmask1
   ___P((int how,
         int sig,
         ___sigset_type *oldset),
        ());

#endif


extern ___SCMOBJ ___setup_thread_module ___PVOID;

extern void ___cleanup_thread_module ___PVOID;


/*---------------------------------------------------------------------------*/


#endif