mirror of
https://github.com/python/cpython
synced 2024-11-02 12:55:22 +00:00
0c89056fe5
PyMutex is a one byte lock with fast, inlineable lock and unlock functions for the common uncontended case. The design is based on WebKit's WTF::Lock. PyMutex is built using the _PyParkingLot APIs, which provides a cross-platform futex-like API (based on WebKit's WTF::ParkingLot). This internal API will be used for building other synchronization primitives used to implement PEP 703, such as one-time initialization and events. This also includes tests and a mini benchmark in Tools/lockbench/lockbench.py to compare with the existing PyThread_type_lock. Uncontended acquisition + release: * Linux (x86-64): PyMutex: 11 ns, PyThread_type_lock: 44 ns * macOS (arm64): PyMutex: 13 ns, PyThread_type_lock: 18 ns * Windows (x86-64): PyMutex: 13 ns, PyThread_type_lock: 38 ns PR Overview: The primary purpose of this PR is to implement PyMutex, but there are a number of support pieces (described below). * PyMutex: A 1-byte lock that doesn't require memory allocation to initialize and is generally faster than the existing PyThread_type_lock. The API is internal only for now. * _PyParking_Lot: A futex-like API based on the API of the same name in WebKit. Used to implement PyMutex. * _PyRawMutex: A word sized lock used to implement _PyParking_Lot. * PyEvent: A one time event. This was used a bunch in the "nogil" fork and is useful for testing the PyMutex implementation, so I've included it as part of the PR. * pycore_llist.h: Defines common operations on doubly-linked list. Not strictly necessary (could do the list operations manually), but they come up frequently in the "nogil" fork. ( Similar to https://man.freebsd.org/cgi/man.cgi?queue) --------- Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
112 lines
4.4 KiB
XML
112 lines
4.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<ItemGroup Label="ProjectConfigurations">
|
|
<ProjectConfiguration Include="Debug|ARM">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>ARM</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Debug|ARM64">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Debug|Win32">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>Win32</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Debug|x64">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGInstrument|ARM">
|
|
<Configuration>PGInstrument</Configuration>
|
|
<Platform>ARM</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGInstrument|ARM64">
|
|
<Configuration>PGInstrument</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGInstrument|Win32">
|
|
<Configuration>PGInstrument</Configuration>
|
|
<Platform>Win32</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGInstrument|x64">
|
|
<Configuration>PGInstrument</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGUpdate|ARM">
|
|
<Configuration>PGUpdate</Configuration>
|
|
<Platform>ARM</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGUpdate|ARM64">
|
|
<Configuration>PGUpdate</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGUpdate|Win32">
|
|
<Configuration>PGUpdate</Configuration>
|
|
<Platform>Win32</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="PGUpdate|x64">
|
|
<Configuration>PGUpdate</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|ARM">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>ARM</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|ARM64">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|Win32">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>Win32</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|x64">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
</ItemGroup>
|
|
<PropertyGroup Label="Globals">
|
|
<ProjectGuid>{900342D7-516A-4469-B1AD-59A66E49A25F}</ProjectGuid>
|
|
<RootNamespace>_testinternalcapi</RootNamespace>
|
|
<Keyword>Win32Proj</Keyword>
|
|
<SupportPGO>false</SupportPGO>
|
|
</PropertyGroup>
|
|
<Import Project="python.props" />
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
<PropertyGroup Label="Configuration">
|
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
<CharacterSet>NotSet</CharacterSet>
|
|
</PropertyGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
<PropertyGroup>
|
|
<TargetExt>.pyd</TargetExt>
|
|
</PropertyGroup>
|
|
<ImportGroup Label="ExtensionSettings">
|
|
</ImportGroup>
|
|
<ImportGroup Label="PropertySheets">
|
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
<Import Project="pyproject.props" />
|
|
</ImportGroup>
|
|
<PropertyGroup Label="UserMacros" />
|
|
<PropertyGroup>
|
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<ClCompile Include="..\Modules\_testinternalcapi.c" />
|
|
<ClCompile Include="..\Modules\_testinternalcapi\pytime.c" />
|
|
<ClCompile Include="..\Modules\_testinternalcapi\test_lock.c" />
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<ResourceCompile Include="..\PC\python_nt.rc" />
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<ProjectReference Include="pythoncore.vcxproj">
|
|
<Project>{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}</Project>
|
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
|
</ProjectReference>
|
|
</ItemGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
<ImportGroup Label="ExtensionTargets">
|
|
</ImportGroup>
|
|
</Project>
|