summaryrefslogtreecommitdiffstats
path: root/webkit/build/JavaScriptCore/pthread.h
blob: 3259fe8bbbb239a1b4efd716eae8f362db8b6f16 (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
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
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_WEBKIT_BUILD_JAVASCRIPTCORE_PTHREAD_H__
#define CHROME_WEBKIT_BUILD_JAVASCRIPTCORE_PTHREAD_H__

#include <errno.h>
#include "wtf/Assertions.h"

// Dummy implementations of various pthread APIs

// ----------------------------------------------------------------------------
// pthread_t

typedef int pthread_t;

inline pthread_t pthread_self() {
  return 0;
}
inline int pthread_equal(pthread_t a, pthread_t b) {
  return a == b;
}
inline int pthread_create(pthread_t* thread, void*, void* (*)(void*), void*) {
  ASSERT_NOT_REACHED();
  return EINVAL;
}
inline int pthread_join(pthread_t thread, void **) {
  ASSERT_NOT_REACHED();
  return EINVAL;
}

// ----------------------------------------------------------------------------
// pthread_mutex_t

typedef int pthread_mutex_t;

inline int pthread_mutex_init(pthread_mutex_t* mutex, const void*) {
  return 0;
}
inline int pthread_mutex_destroy(pthread_mutex_t* mutex) {
  return 0;
}
inline int pthread_mutex_lock(pthread_mutex_t* mutex) {
  return 0;
}

inline int pthread_mutex_trylock(pthread_mutex_t* mutex) {
  return 0;
}

inline int pthread_mutex_unlock(pthread_mutex_t* mutex) {
  return 0;
}

#define PTHREAD_MUTEX_INITIALIZER 0

//
// pthread_cond_t
typedef int pthread_cond_t;

inline int pthread_cond_init(pthread_cond_t* cond, const void*) {
  return 0;
}
inline int pthread_cond_destroy(pthread_cond_t* cond) {
  return 0;
}

inline int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *) {
  return 0;
}
inline int pthread_cond_signal(pthread_cond_t *) {
  return 0;
}
inline int pthread_cond_broadcast(pthread_cond_t *) {
  return 0;
}

// ----------------------------------------------------------------------------
// pthread_key_t

typedef int pthread_key_t;

void pthread_setspecific(pthread_key_t key, void* value) {
  TlsSetValue(key, value);
}

void pthread_key_create(pthread_key_t* key, void* destructor) {
  // TODO(mbelshe): hook up the per-thread destructor.
  *key = TlsAlloc();
}


#endif  // CHROME_WEBKIT_BUILD_JAVASCRIPTCORE_PTHREAD_H__