OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_WEBKIT_BUILD_JAVASCRIPTCORE_PTHREAD_H__ |
| 6 #define CHROME_WEBKIT_BUILD_JAVASCRIPTCORE_PTHREAD_H__ |
| 7 |
| 8 #include <errno.h> |
| 9 #include "wtf/Assertions.h" |
| 10 |
| 11 // Dummy implementations of various pthread APIs |
| 12 |
| 13 // ---------------------------------------------------------------------------- |
| 14 // pthread_t |
| 15 |
| 16 typedef int pthread_t; |
| 17 |
| 18 inline pthread_t pthread_self() { |
| 19 return 0; |
| 20 } |
| 21 inline int pthread_equal(pthread_t a, pthread_t b) { |
| 22 return a == b; |
| 23 } |
| 24 inline int pthread_create(pthread_t* thread, void*, void* (*)(void*), void*) { |
| 25 ASSERT_NOT_REACHED(); |
| 26 return EINVAL; |
| 27 } |
| 28 inline int pthread_join(pthread_t thread, void **) { |
| 29 ASSERT_NOT_REACHED(); |
| 30 return EINVAL; |
| 31 } |
| 32 |
| 33 // ---------------------------------------------------------------------------- |
| 34 // pthread_mutex_t |
| 35 |
| 36 typedef int pthread_mutex_t; |
| 37 |
| 38 inline int pthread_mutex_init(pthread_mutex_t* mutex, const void*) { |
| 39 return 0; |
| 40 } |
| 41 inline int pthread_mutex_destroy(pthread_mutex_t* mutex) { |
| 42 return 0; |
| 43 } |
| 44 inline int pthread_mutex_lock(pthread_mutex_t* mutex) { |
| 45 return 0; |
| 46 } |
| 47 |
| 48 inline int pthread_mutex_trylock(pthread_mutex_t* mutex) { |
| 49 return 0; |
| 50 } |
| 51 |
| 52 inline int pthread_mutex_unlock(pthread_mutex_t* mutex) { |
| 53 return 0; |
| 54 } |
| 55 |
| 56 #define PTHREAD_MUTEX_INITIALIZER 0 |
| 57 |
| 58 // |
| 59 // pthread_cond_t |
| 60 typedef int pthread_cond_t; |
| 61 |
| 62 inline int pthread_cond_init(pthread_cond_t* cond, const void*) { |
| 63 return 0; |
| 64 } |
| 65 inline int pthread_cond_destroy(pthread_cond_t* cond) { |
| 66 return 0; |
| 67 } |
| 68 |
| 69 inline int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *) { |
| 70 return 0; |
| 71 } |
| 72 inline int pthread_cond_signal(pthread_cond_t *) { |
| 73 return 0; |
| 74 } |
| 75 inline int pthread_cond_broadcast(pthread_cond_t *) { |
| 76 return 0; |
| 77 } |
| 78 |
| 79 // ---------------------------------------------------------------------------- |
| 80 // pthread_key_t |
| 81 |
| 82 typedef int pthread_key_t; |
| 83 |
| 84 void pthread_setspecific(pthread_key_t key, void* value) { |
| 85 TlsSetValue(key, value); |
| 86 } |
| 87 |
| 88 void pthread_key_create(pthread_key_t* key, void* destructor) { |
| 89 // TODO(mbelshe): hook up the per-thread destructor. |
| 90 *key = TlsAlloc(); |
| 91 } |
| 92 |
| 93 |
| 94 #endif // CHROME_WEBKIT_BUILD_JAVASCRIPTCORE_PTHREAD_H__ |
OLD | NEW |