get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/94533/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 94533,
    "url": "https://patches.dpdk.org/api/patches/94533/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1624053294-31255-7-git-send-email-navasile@linux.microsoft.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1624053294-31255-7-git-send-email-navasile@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1624053294-31255-7-git-send-email-navasile@linux.microsoft.com",
    "date": "2021-06-18T21:54:54",
    "name": "[6/6] Allow choice between internal EAL thread API and external lib",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "270e7aaffb5f154922a4f342c965e4e56630cd46",
    "submitter": {
        "id": 1668,
        "url": "https://patches.dpdk.org/api/people/1668/?format=api",
        "name": "Narcisa Ana Maria Vasile",
        "email": "navasile@linux.microsoft.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1624053294-31255-7-git-send-email-navasile@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 17403,
            "url": "https://patches.dpdk.org/api/series/17403/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17403",
            "date": "2021-06-18T21:54:48",
            "name": "Enable the internal EAL thread API",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/17403/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/94533/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/94533/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 89903A0A0C;\n\tFri, 18 Jun 2021 23:56:06 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id ADB5C4114A;\n\tFri, 18 Jun 2021 23:55:41 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 03A78410FE\n for <dev@dpdk.org>; Fri, 18 Jun 2021 23:55:35 +0200 (CEST)",
            "by linux.microsoft.com (Postfix, from userid 1059)\n id BCA4520B83F5; Fri, 18 Jun 2021 14:55:33 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com BCA4520B83F5",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1624053333;\n bh=fec28ill9i3a3bdycfR0xIIKCqAdNX9wtJYJr7V3jrc=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=pEiH+dyE7nUJscVlTnIa0Zg1iZAWvgdVv0FDgXUGepxpbnxCigjh9cjETcI8/UgoG\n 8mN/PFTMuJMENXI002RlcxRxrqTjjUBHyU+exZE6+nC7kORd03UrQEIg9QZzOzhKW/\n AlUvA6L6sMnL+LRmrPKMQ8Rkv46cYoK4z6viFCrE=",
        "From": "Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>",
        "To": "dev@dpdk.org, thomas@monjalon.net, dmitry.kozliuk@gmail.com,\n khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com,\n roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com",
        "Cc": "bruce.richardson@intel.com, david.marchand@redhat.com,\n pallavi.kadam@intel.com",
        "Date": "Fri, 18 Jun 2021 14:54:54 -0700",
        "Message-Id": "<1624053294-31255-7-git-send-email-navasile@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1624053294-31255-1-git-send-email-navasile@linux.microsoft.com>",
        "References": "<1624053294-31255-1-git-send-email-navasile@linux.microsoft.com>",
        "Subject": "[dpdk-dev] [PATCH 6/6] Allow choice between internal EAL thread API\n and external lib",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Narcisa Vasile <navasile@microsoft.com>\n\nThe user is offered the option of either using the RTE_THREAD_* API or\na 3rd party thread library, through a meson flag called\n\"use_external_thread_lib\". By default, this flag is set to FALSE,\nwhich means Windows libraries and applications will use the RTE_THREAD_*\nAPI for managing threads.\n\nIf compiling on Windows and the \"use_external_thread_lib\" is *not* set,\nthe following files will be parsed:\n* include/rte_thread.h\n* windows/rte_thread.c\nIn all other cases, the compilation/parsing includes the following files:\n* include/rte_thread.h\n* common/rte_thread.c\n\nSigned-off-by: Narcisa Vasile <navasile@microsoft.com>\n---\n config/meson.build                |   1 -\n lib/eal/windows/include/pthread.h | 192 ------------------------------\n lib/eal/windows/meson.build       |   7 +-\n meson_options.txt                 |   2 +\n 4 files changed, 8 insertions(+), 194 deletions(-)\n delete mode 100644 lib/eal/windows/include/pthread.h",
    "diff": "diff --git a/config/meson.build b/config/meson.build\nindex 017bb2efbb..9309010f21 100644\n--- a/config/meson.build\n+++ b/config/meson.build\n@@ -262,7 +262,6 @@ else # for 32-bit we need smaller reserved memory areas\n     dpdk_conf.set('RTE_MAX_MEM_MB', 2048)\n endif\n \n-\n compile_time_cpuflags = []\n subdir(arch_subdir)\n dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))\ndiff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h\ndeleted file mode 100644\nindex 27fd2cca52..0000000000\n--- a/lib/eal/windows/include/pthread.h\n+++ /dev/null\n@@ -1,192 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2019 Intel Corporation\n- */\n-\n-#ifndef _PTHREAD_H_\n-#define _PTHREAD_H_\n-\n-#include <stdint.h>\n-#include <sched.h>\n-\n-/**\n- * This file is required to support the common code in eal_common_proc.c,\n- * eal_common_thread.c and common\\include\\rte_per_lcore.h as Microsoft libc\n- * does not contain pthread.h. This may be removed in future releases.\n- */\n-#ifdef __cplusplus\n-extern \"C\" {\n-#endif\n-\n-#include <rte_common.h>\n-#include <rte_windows.h>\n-\n-#define PTHREAD_BARRIER_SERIAL_THREAD TRUE\n-\n-/* defining pthread_t type on Windows since there is no in Microsoft libc*/\n-typedef uintptr_t pthread_t;\n-\n-/* defining pthread_attr_t type on Windows since there is no in Microsoft libc*/\n-typedef void *pthread_attr_t;\n-\n-typedef void *pthread_mutexattr_t;\n-\n-typedef CRITICAL_SECTION pthread_mutex_t;\n-\n-typedef SYNCHRONIZATION_BARRIER pthread_barrier_t;\n-\n-#define pthread_barrier_init(barrier, attr, count) \\\n-\t!InitializeSynchronizationBarrier(barrier, count, -1)\n-#define pthread_barrier_wait(barrier) EnterSynchronizationBarrier(barrier, \\\n-\tSYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY)\n-#define pthread_barrier_destroy(barrier) \\\n-\t!DeleteSynchronizationBarrier(barrier)\n-#define pthread_cancel(thread) !TerminateThread((HANDLE) thread, 0)\n-\n-/* pthread function overrides */\n-#define pthread_self() \\\n-\t((pthread_t)GetCurrentThreadId())\n-\n-\n-static inline int\n-pthread_equal(pthread_t t1, pthread_t t2)\n-{\n-\treturn t1 == t2;\n-}\n-\n-static inline int\n-pthread_setaffinity_np(pthread_t threadid, size_t cpuset_size,\n-\t\t\trte_cpuset_t *cpuset)\n-{\n-\tDWORD_PTR ret = 0;\n-\tHANDLE thread_handle;\n-\n-\tif (cpuset == NULL || cpuset_size == 0)\n-\t\treturn -1;\n-\n-\tthread_handle = OpenThread(THREAD_ALL_ACCESS, FALSE, threadid);\n-\tif (thread_handle == NULL) {\n-\t\tRTE_LOG_WIN32_ERR(\"OpenThread()\");\n-\t\treturn -1;\n-\t}\n-\n-\tret = SetThreadAffinityMask(thread_handle, *cpuset->_bits);\n-\tif (ret == 0) {\n-\t\tRTE_LOG_WIN32_ERR(\"SetThreadAffinityMask()\");\n-\t\tgoto close_handle;\n-\t}\n-\n-close_handle:\n-\tif (CloseHandle(thread_handle) == 0) {\n-\t\tRTE_LOG_WIN32_ERR(\"CloseHandle()\");\n-\t\treturn -1;\n-\t}\n-\treturn (ret == 0) ? -1 : 0;\n-}\n-\n-static inline int\n-pthread_getaffinity_np(pthread_t threadid, size_t cpuset_size,\n-\t\t\trte_cpuset_t *cpuset)\n-{\n-\t/* Workaround for the lack of a GetThreadAffinityMask()\n-\t *API in Windows\n-\t */\n-\tDWORD_PTR prev_affinity_mask;\n-\tHANDLE thread_handle;\n-\tDWORD_PTR ret = 0;\n-\n-\tif (cpuset == NULL || cpuset_size == 0)\n-\t\treturn -1;\n-\n-\tthread_handle = OpenThread(THREAD_ALL_ACCESS, FALSE, threadid);\n-\tif (thread_handle == NULL) {\n-\t\tRTE_LOG_WIN32_ERR(\"OpenThread()\");\n-\t\treturn -1;\n-\t}\n-\n-\t/* obtain previous mask by setting dummy mask */\n-\tprev_affinity_mask = SetThreadAffinityMask(thread_handle, 0x1);\n-\tif (prev_affinity_mask == 0) {\n-\t\tRTE_LOG_WIN32_ERR(\"SetThreadAffinityMask()\");\n-\t\tgoto close_handle;\n-\t}\n-\n-\t/* set it back! */\n-\tret = SetThreadAffinityMask(thread_handle, prev_affinity_mask);\n-\tif (ret == 0) {\n-\t\tRTE_LOG_WIN32_ERR(\"SetThreadAffinityMask()\");\n-\t\tgoto close_handle;\n-\t}\n-\n-\tmemset(cpuset, 0, cpuset_size);\n-\t*cpuset->_bits = prev_affinity_mask;\n-\n-close_handle:\n-\tif (CloseHandle(thread_handle) == 0) {\n-\t\tRTE_LOG_WIN32_ERR(\"SetThreadAffinityMask()\");\n-\t\treturn -1;\n-\t}\n-\treturn (ret == 0) ? -1 : 0;\n-}\n-\n-static inline int\n-pthread_create(void *threadid, const void *threadattr, void *threadfunc,\n-\t\tvoid *args)\n-{\n-\tRTE_SET_USED(threadattr);\n-\tHANDLE hThread;\n-\thThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,\n-\t\targs, 0, (LPDWORD)threadid);\n-\tif (hThread) {\n-\t\tSetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);\n-\t\tSetThreadPriority(hThread, THREAD_PRIORITY_NORMAL);\n-\t}\n-\treturn ((hThread != NULL) ? 0 : E_FAIL);\n-}\n-\n-static inline int\n-pthread_detach(__rte_unused pthread_t thread)\n-{\n-\treturn 0;\n-}\n-\n-static inline int\n-pthread_join(__rte_unused pthread_t thread,\n-\t__rte_unused void **value_ptr)\n-{\n-\treturn 0;\n-}\n-\n-static inline int\n-pthread_mutex_init(pthread_mutex_t *mutex,\n-\t\t   __rte_unused pthread_mutexattr_t *attr)\n-{\n-\tInitializeCriticalSection(mutex);\n-\treturn 0;\n-}\n-\n-static inline int\n-pthread_mutex_lock(pthread_mutex_t *mutex)\n-{\n-\tEnterCriticalSection(mutex);\n-\treturn 0;\n-}\n-\n-static inline int\n-pthread_mutex_unlock(pthread_mutex_t *mutex)\n-{\n-\tLeaveCriticalSection(mutex);\n-\treturn 0;\n-}\n-\n-static inline int\n-pthread_mutex_destroy(pthread_mutex_t *mutex)\n-{\n-\tDeleteCriticalSection(mutex);\n-\treturn 0;\n-}\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-\n-#endif /* _PTHREAD_H_ */\ndiff --git a/lib/eal/windows/meson.build b/lib/eal/windows/meson.build\nindex ff9cbec417..4b7db4754b 100644\n--- a/lib/eal/windows/meson.build\n+++ b/lib/eal/windows/meson.build\n@@ -19,7 +19,12 @@ sources += files(\n         'eal_timer.c',\n         'fnmatch.c',\n         'getopt.c',\n-        'rte_thread.c',\n )\n \n+if get_option('use_external_thread_lib')\n+\tsources += 'eal/common/rte_thread.c'\n+else\n+\tsources += 'eal/windows/rte_thread.c'\n+endif\n+\n dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true)\ndiff --git a/meson_options.txt b/meson_options.txt\nindex 56bdfd0f0a..2606c8b3a4 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -44,3 +44,5 @@ option('tests', type: 'boolean', value: true, description:\n        'build unit tests')\n option('use_hpet', type: 'boolean', value: false, description:\n        'use HPET timer in EAL')\n+option('use_external_thread_lib', type: 'boolean', value: false,\n+\tdescription: 'use an external thread library')\n",
    "prefixes": [
        "6/6"
    ]
}