diff options
author | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-08 21:43:45 +0000 |
---|---|---|
committer | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-08 21:43:45 +0000 |
commit | 37849e6fbd82c84d10b23a829c6274d460c2d0a7 (patch) | |
tree | 1160643392c57a32f484713a9e9cd848422a4433 /native_client_sdk | |
parent | e20703d54a4a4667ca064ae773a05598601c35f3 (diff) | |
download | chromium_src-37849e6fbd82c84d10b23a829c6274d460c2d0a7.zip chromium_src-37849e6fbd82c84d10b23a829c6274d460c2d0a7.tar.gz chromium_src-37849e6fbd82c84d10b23a829c6274d460c2d0a7.tar.bz2 |
[NaCl SDK] Remove old pthreads library. Just use pthreads-win32 now.
BUG=149754
TBR=noelallen@chromium.org
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11072004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r-- | native_client_sdk/src/libraries/pthread/pthread.c | 103 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/pthread/pthread.h | 45 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/win/dirent.h | 26 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/win/pthread.c | 44 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/win/pthread.h | 27 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/win/stdint.h | 33 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/win/win.vcproj | 180 |
7 files changed, 0 insertions, 458 deletions
diff --git a/native_client_sdk/src/libraries/pthread/pthread.c b/native_client_sdk/src/libraries/pthread/pthread.c deleted file mode 100644 index fd55b90..0000000 --- a/native_client_sdk/src/libraries/pthread/pthread.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (c) 2012 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. - */ -#include <windows.h> -#include <errno.h> -#include "pthread.h" - -int pthread_mutex_init(pthread_mutex_t* m, void* attrs) { - InitializeCriticalSection(m); - return 0; -} - -int pthread_mutex_destroy(pthread_mutex_t* m) { - DeleteCriticalSection(m); - return 0; -} - -int pthread_mutex_lock(pthread_mutex_t* m) { - EnterCriticalSection(m); - return 0; -} - -int pthread_mutex_unlock(pthread_mutex_t* m) { - LeaveCriticalSection(m); - return 0; -} - -int pthread_mutex_trylock(pthread_mutex_t* m) { - if (TryEnterCriticalSection(m)) - return 0; - return EBUSY; -} - -int pthread_cond_init(pthread_cond_t* c, void* attrs) { - InitializeConditionVariable(c); - return 0; -} - -int pthread_cond_destroy(pthread_cond_t* c) { - return 0; -} - -int pthread_cond_broadcast(pthread_cond_t* c) { - WakeAllConditionVariable(c); - return 0; -} - -int pthread_cond_signal(pthread_cond_t* c) { - WakeConditionVariable(c); - return 0; -} - -int pthread_cond_wait(pthread_cond_t* c, pthread_mutex_t* m) { - if (SleepConditionVariableCS(c, m, INFINITE)) - return 0; - return EINVAL; -} - -typedef struct { - void* (*start_routine)(void*); - void* arg; -} PthreadCreateInfo; - -static DWORD WINAPI PthreadCreateThreadFunc(LPVOID param) { - PthreadCreateInfo* pthread_create_info = (PthreadCreateInfo*)param; - void* result = (pthread_create_info->start_routine)(pthread_create_info->arg); - (void)result; // Ignore result - HeapFree(GetProcessHeap(), 0, pthread_create_info); - return 0; -} - -int pthread_create(pthread_t* t, - void* attrs, - void* (*start_routine)(void*), - void* arg) { - HANDLE thread_handle; - PthreadCreateInfo* pthread_create_info; - - pthread_create_info = (PthreadCreateInfo*)HeapAlloc( - GetProcessHeap(), - 0, - sizeof(PthreadCreateInfo)); - if (pthread_create_info == NULL) - return EAGAIN; - - pthread_create_info->start_routine = start_routine; - pthread_create_info->arg = arg; - - thread_handle = CreateThread(NULL, // lpThreadAttributes - 0, // dwStackSize - &PthreadCreateThreadFunc, // lpStartAddress - pthread_create_info, // lpParameter, - 0, // dwCreationFlags - NULL); // lpThreadId - if (thread_handle == NULL) { - HeapFree(GetProcessHeap(), 0, pthread_create_info); - return EAGAIN; - } - - *t = thread_handle; - return 0; -} diff --git a/native_client_sdk/src/libraries/pthread/pthread.h b/native_client_sdk/src/libraries/pthread/pthread.h deleted file mode 100644 index c9125bf..0000000 --- a/native_client_sdk/src/libraries/pthread/pthread.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2012 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 LIBRARIES_PTHREAD_PTHREAD_H_ -#define LIBRARIES_PTHREAD_PTHREAD_H_ - -/** -* Implementation of pthread.h for building the SDK natively on Windows. -*/ - -#include <windows.h> -#include <time.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef HANDLE pthread_t; -typedef CRITICAL_SECTION pthread_mutex_t; -typedef CONDITION_VARIABLE pthread_cond_t; - -int pthread_mutex_init(pthread_mutex_t* m, void* attrs); -int pthread_mutex_destroy(pthread_mutex_t* m); -int pthread_mutex_lock(pthread_mutex_t* m); -int pthread_mutex_unlock(pthread_mutex_t* m); -int pthread_mutex_trylock(pthread_mutex_t* m); - -int pthread_cond_init(pthread_cond_t* c, void* attrs); -int pthread_cond_destroy(pthread_cond_t* c); -int pthread_cond_broadcast(pthread_cond_t* c); -int pthread_cond_signal(pthread_cond_t* c); -int pthread_cond_wait(pthread_cond_t* c, pthread_mutex_t* m); - -int pthread_create(pthread_t* t, - void* attrs, - void* (*start_routine)(void*), - void* arg); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBRARIES_PTHREAD_PTHREAD_H_ */ diff --git a/native_client_sdk/src/libraries/win/dirent.h b/native_client_sdk/src/libraries/win/dirent.h deleted file mode 100644 index b3377e5..0000000 --- a/native_client_sdk/src/libraries/win/dirent.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2012 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 LIBRARIES_WIN_DIRENT_H_ -#define LIBRARIES_WIN_DIRENT_H_ - -#include <stdint.h> -#include "macros.h" - -EXTERN_C_BEGIN - -/** -* Implementation of dirent.h for building the SDK natively Windows. -*/ -struct dirent { - ino_t d_ino; - off_t d_off; - uint16_t d_reclen; - char d_name[256]; -}; - -EXTERN_C_END - -#endif /* LIBRARIES_WIN_DIRENT_H_ */ diff --git a/native_client_sdk/src/libraries/win/pthread.c b/native_client_sdk/src/libraries/win/pthread.c deleted file mode 100644 index 34d9ad2..0000000 --- a/native_client_sdk/src/libraries/win/pthread.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2012 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. - */ -#include <windows.h> -#include <errno.h> -#include "pthread.h" - -int pthread_mutex_init(pthread_mutex_t* m, void* traits) { - *m = (int) CreateMutex(NULL, 0, NULL); - return 0; -} - -int pthread_mutex_destroy(pthread_mutex_t* m) { - CloseHandle((HANDLE) *m); - return 0; -} - -int pthread_mutex_lock(pthread_mutex_t* m) { - if (WaitForSingleObject((HANDLE) *m, INFINITE) == WAIT_OBJECT_0) - return 0; - - return EINVAL; -} - -int pthread_mutex_unlock(pthread_mutex_t* m) { - if (ReleaseMutex((HANDLE) *m)) return 0; - - return EINVAL; -} - -int pthread_mutex_trylock(pthread_mutex_t* m) { - int val = WaitForSingleObject((HANDLE) *m, 0); - - if (val == WAIT_OBJECT_0) return 0; - - if (val == WAIT_TIMEOUT) { - errno = EBUSY; - } - else { - errno = EINVAL; - } - return -1; -}
\ No newline at end of file diff --git a/native_client_sdk/src/libraries/win/pthread.h b/native_client_sdk/src/libraries/win/pthread.h deleted file mode 100644 index 5089755..0000000 --- a/native_client_sdk/src/libraries/win/pthread.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) 2012 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 LIBRARIES_WIN_PTHREAD_H_ -#define LIBRARIES_WIN_PTHREAD_H_ - -#include "macros.h" - -/** -* Implementation of pthread.h for building the SDK natively Windows. -*/ - -EXTERN_C_BEGIN - -typedef int pthread_mutex_t; - -int pthread_mutex_init(pthread_mutex_t* m, void* traits); -int pthread_mutex_destroy(pthread_mutex_t* m); - -int pthread_mutex_lock(pthread_mutex_t* m); -int pthread_mutex_unlock(pthread_mutex_t* m); - -EXTERN_C_END - -#endif /* LIBRARIES_WIN_PTHREAD_H_ */
\ No newline at end of file diff --git a/native_client_sdk/src/libraries/win/stdint.h b/native_client_sdk/src/libraries/win/stdint.h deleted file mode 100644 index 6237f40..0000000 --- a/native_client_sdk/src/libraries/win/stdint.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (c) 2012 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 LIBRARIES_WIN_STDINT_H_ -#define LIBRARIES_WIN_STDINT_H_ - -/** -* Implementation of pthread.h for building the SDK natively Windows. -*/ - -#include <sys\types.h> - -#ifdef _WIN64 -typedef __int64 ssize_t; -#else -typedef long ssize_t; -#endif - -typedef char int8_t; -typedef short int16_t; -typedef long int32_t; -typedef long long int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned long uint32_t; -typedef unsigned long long uint64_t; - -typedef uint32_t mode_t; - -#endif /* LIBRARIES_WIN_STDINT_H_ */ diff --git a/native_client_sdk/src/libraries/win/win.vcproj b/native_client_sdk/src/libraries/win/win.vcproj deleted file mode 100644 index 4751e98..0000000 --- a/native_client_sdk/src/libraries/win/win.vcproj +++ /dev/null @@ -1,180 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="win" - ProjectGUID="{F2C30387-4750-47CF-B523-A77A37B30A78}" - Keyword="Win32Proj" - TargetFrameworkVersion="0" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="../utils" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="../util" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\dirent.h" - > - </File> - <File - RelativePath=".\pthread.h" - > - </File> - <File - RelativePath=".\stdint.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\pthread.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> |