aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/zstd/lib/common/threading.c
diff options
context:
space:
mode:
authorigorsolovyev <igorsolovyev@yandex-team.ru>2022-02-10 16:48:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:03 +0300
commit93dc653cf53bf7a9319b52b85a7c02edfd95463d (patch)
treeb85de7682b5f10d28a798003716a65756425aa15 /contrib/libs/zstd/lib/common/threading.c
parent6ab7e5f5ada0643a48d393717f443bd548706ffc (diff)
downloadydb-93dc653cf53bf7a9319b52b85a7c02edfd95463d.tar.gz
Restoring authorship annotation for <igorsolovyev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/zstd/lib/common/threading.c')
-rw-r--r--contrib/libs/zstd/lib/common/threading.c138
1 files changed, 69 insertions, 69 deletions
diff --git a/contrib/libs/zstd/lib/common/threading.c b/contrib/libs/zstd/lib/common/threading.c
index 92cf57c195..c0c2adb937 100644
--- a/contrib/libs/zstd/lib/common/threading.c
+++ b/contrib/libs/zstd/lib/common/threading.c
@@ -1,80 +1,80 @@
-/**
- * Copyright (c) 2016 Tino Reichardt
- * All rights reserved.
- *
+/**
+ * Copyright (c) 2016 Tino Reichardt
+ * All rights reserved.
+ *
* You can contact the author at:
* - zstdmt source repository: https://github.com/mcmilk/zstdmt
*
- * This source code is licensed under both the BSD-style license (found in the
- * LICENSE file in the root directory of this source tree) and the GPLv2 (found
- * in the COPYING file in the root directory of this source tree).
+ * This source code is licensed under both the BSD-style license (found in the
+ * LICENSE file in the root directory of this source tree) and the GPLv2 (found
+ * in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
- */
-
-/**
- * This file will hold wrapper for systems, which do not support pthreads
- */
-
+ */
+
+/**
+ * This file will hold wrapper for systems, which do not support pthreads
+ */
+
#include "threading.h"
/* create fake symbol to avoid empty translation unit warning */
int g_ZSTD_threading_useless_symbol;
-
-#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
-
-/**
- * Windows minimalist Pthread Wrapper, based on :
- * http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
- */
-
-
-/* === Dependencies === */
-#include <process.h>
-#include <errno.h>
-
-
-/* === Implementation === */
-
-static unsigned __stdcall worker(void *arg)
-{
- ZSTD_pthread_t* const thread = (ZSTD_pthread_t*) arg;
- thread->arg = thread->start_routine(thread->arg);
- return 0;
-}
-
-int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused,
- void* (*start_routine) (void*), void* arg)
-{
- (void)unused;
- thread->arg = arg;
- thread->start_routine = start_routine;
- thread->handle = (HANDLE) _beginthreadex(NULL, 0, worker, thread, 0, NULL);
-
- if (!thread->handle)
- return errno;
- else
- return 0;
-}
-
-int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr)
-{
- DWORD result;
-
- if (!thread.handle) return 0;
-
- result = WaitForSingleObject(thread.handle, INFINITE);
- switch (result) {
- case WAIT_OBJECT_0:
- if (value_ptr) *value_ptr = thread.arg;
- return 0;
- case WAIT_ABANDONED:
- return EINVAL;
- default:
- return GetLastError();
- }
-}
-
-#endif /* ZSTD_MULTITHREAD */
+
+#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
+
+/**
+ * Windows minimalist Pthread Wrapper, based on :
+ * http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
+ */
+
+
+/* === Dependencies === */
+#include <process.h>
+#include <errno.h>
+
+
+/* === Implementation === */
+
+static unsigned __stdcall worker(void *arg)
+{
+ ZSTD_pthread_t* const thread = (ZSTD_pthread_t*) arg;
+ thread->arg = thread->start_routine(thread->arg);
+ return 0;
+}
+
+int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused,
+ void* (*start_routine) (void*), void* arg)
+{
+ (void)unused;
+ thread->arg = arg;
+ thread->start_routine = start_routine;
+ thread->handle = (HANDLE) _beginthreadex(NULL, 0, worker, thread, 0, NULL);
+
+ if (!thread->handle)
+ return errno;
+ else
+ return 0;
+}
+
+int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr)
+{
+ DWORD result;
+
+ if (!thread.handle) return 0;
+
+ result = WaitForSingleObject(thread.handle, INFINITE);
+ switch (result) {
+ case WAIT_OBJECT_0:
+ if (value_ptr) *value_ptr = thread.arg;
+ return 0;
+ case WAIT_ABANDONED:
+ return EINVAL;
+ default:
+ return GetLastError();
+ }
+}
+
+#endif /* ZSTD_MULTITHREAD */
#if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32)