DEENESPTFRRUARHIKOZHNL

类 ara::core::SynchronizedPoolResource

[SWS_CORE_00029] Upstream: RS_AP_00130

class SynchronizedPoolResource :           public MemoryResource {...};

Implementation of std::pmr::synchronized_pool_resource from [mem.res.pool]

Header-Datei#include "ara/core/memory_resource.h"
Forwarding-Header#include "ara/core/core_fwd.h"
Scopenamespace ara::core
Basisklasse(n)MemoryResource

用户指南人工智能生成

提供线程安全的池内存资源,用于内存块的高效分配与释放。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 8c6c1308f3f6 来源 未决问题(3)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

提供线程安全的池内存资源,用于内存块的高效分配与释放。

类 ara::core::SynchronizedPoolResource 提供了一种线程安全的内存资源,该资源通过内部内存池处理分配,并向上级上游资源请求额外内存 ([SWS_CORE_00030])。与 C++ 标准不同,内存分配失败时不会抛出异常,而是返回 nullptr ([SWS_CORE_00061])。复制操作被完全禁止,而移动操作得到显式支持。此外,析构函数是非虚的,因此不得通过基类指针多态释放实例。

上下文

类 ara::core::SynchronizedPoolResource 为 AUTOSAR Adaptive Platform 在模块 core 内提供线程安全的内存资源。它基于符合 C++ 标准 [mem.res.pool] 的 std::pmr::synchronized_pool_resource 概念,并公有继承自基类 MemoryResource。其核心任务是按大小类别通过内部池管理内存块,以便高效且并发地处理重复分配。如果内部储备不足,该实例会从上级上游内存资源 ([SWS_CORE_00038]) 获取更大的内存块。

典型的交互方包括请求分配的应用程序并发线程、作为中介池管理器的 SynchronizedPoolResource 以及作为上游来源的底层 MemoryResource。所有核心访问与管理功能(如 do_allocate、do_deallocate、options 和 release)均设计为线程安全的 ([SWS_CORE_00061]、[SWS_CORE_00041]、[SWS_CORE_00039]、[SWS_CORE_00037])。

SynchronizedPoolResourceKontext Client Aufrufende Threads Pool ara::core::SynchronizedPoolResource Client->Pool Zuteilung / Freigabe Upstream Upstream MemoryResource Pool->Upstream Chunk-Allokation / release()

上下文图:应用程序并发线程、池资源与上游内存源之间的交互。来源:[SWS_CORE_00030]、[SWS_CORE_00038]。

生命周期

SynchronizedPoolResource 的实例化可以通过多个构造函数重载来执行。如果分配选项 (PoolOptions) 和上游资源均可用,则初始化保证完全的异常安全性,并被声明为 noexcept ([SWS_CORE_00030])。此外,还存在无参数构造函数 ([SWS_CORE_00031])、仅带有上游指针的构造函数 ([SWS_CORE_00032]) 或仅带有池选项的构造函数 ([SWS_CORE_00033])。解释:如果不传递上游指针,实现可能会使用平台特定的默认内存资源。 问题 Q-5dafb414672249dc (未决)

在所有权关系方面,该类严格禁止复制:复制构造函数 ([SWS_CORE_00034]) 和复制赋值运算符 ([SWS_CORE_00036]) 均被删除 (=delete)。但与 ISO C++17 标准相反,AUTOSAR 为该类显式定义了移动语义:移动构造函数 ([SWS_CORE_00043]) 和移动赋值运算符 ([SWS_CORE_00044]) 分别作为 noexcept=default 提供。

销毁的一个核心方面是与标准行为的偏差:析构函数 ~SynchronizedPoolResource() 显式为非虚的 ([SWS_CORE_00035])。解释:由于析构函数是非虚的,通过基类 MemoryResource* 的指针进行多态销毁可能导致未定义行为;因此,实例应始终通过其具体类型进行销毁。 问题 Q-5add73880279b024 (未决)此外,通过调用 release(),可以将所有已分配的内存归还给上游资源,同时保持资源对象完好无损 ([SWS_CORE_00037])。

使用路径

典型流程包括初始化、内存块的重复分配与释放,以及最终的清理:

  1. 初始化:应用程序在指定配置参数和上级内存资源 ([SWS_CORE_00030]) 的情况下创建实例。可以通过 options() 查询活动设置 ([SWS_CORE_00039]),通过 upstream_resource() 查询上游指针 ([SWS_CORE_00038])。
  2. 内存分配:内存请求通过受保护的 do_allocate 进行处理 ([SWS_CORE_00061])。解释:应用程序代码中的调用通常不是直接通过受保护的方法 do_allocate 进行,而是通过基类 MemoryResource 继承的公有接口 allocate 进行。 问题 Q-1542a47cdff73dfb (未决)
  3. 同一性检查:可通过 do_is_equal 确定两个内存资源是否彼此等价([SWS_CORE_00042])。
  4. 释放:单个内存区域通过 do_deallocate 归还给内存池([SWS_CORE_00041])。必要时,可通过 release() 将所有内存池的全部内存集中归还给上游资源([SWS_CORE_00037])。
SynchronizedPoolResource 的使用流程应用SynchronizedPoolResourceUpstreamResourceUse Case: InitialisierungSynchronizedPoolResource(opts, &upstream)Use Case: Allokationdo_allocate(bytes, alignment)opt内存池耗尽 / 需要分块 (Chunk)Speicher anfordernSpeicherbereichSpeicherzeiger / nullptrUse Case: 释放与清理do_deallocate(p, bytes, alignment)release()将内存归还给上游

时序图:通过上游资源进行初始化、内存请求、释放和清理的典型流程。来源:[SWS_CORE_00030]、[SWS_CORE_00061]、[SWS_CORE_00041]、[SWS_CORE_00037]。

错误场景

AUTOSAR Adaptive Platform 在错误处理方面特意偏离了 C++ 标准的异常规范:

  • 分配错误:虽然 ISO-C++ 规定在耗尽时抛出 std::bad_alloc,但 do_allocate 在 AUTOSAR 中被定义为 noexcept。如果无法提供匹配的内存块,该方法将强制返回空指针(nullptr)([SWS_CORE_00061])。因此,调用者必须检查每个分配返回值是否为 nullptr。
  • 去分配错误:方法 do_deallocate 同样为 noexcept。根据规范,如果归还内存块时发生错误,该错误将被静默忽略([SWS_CORE_00041])。
  • 构造风险:带选项和上游资源的构造函数具有异常安全性([SWS_CORE_00030]),而未指定上游或不带选项的构造函数则被归类为非异常安全(“not exception safe”)([SWS_CORE_00031]、[SWS_CORE_00032]、[SWS_CORE_00033])。解释:如果这些构造函数在内部提供内存池管理结构时失败,则对象创建可能会失败。 问题 (未决)

本类指南总结了适用于 AUTOSAR Adaptive Release R25-11 的 ara::core::SynchronizedPoolResource 规范。

成员图

类图

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__core__SynchronizedPoolResource481 SynchronizedPoolResource + SynchronizedPoolResource() + operator=() + ~SynchronizedPoolResource() + options() + release() + upstream_resource() + do_allocate() + do_deallocate() + do_is_equal() nara__core__MemoryResource130 MemoryResource nara__core__SynchronizedPoolResource481->nara__core__MemoryResource130

详细视图

请在大纲中选择一个条目。

构造函数和析构函数

≙ [mem.res.pool]

重载 SynchronizedPoolResource 6
SynchronizedPoolResource (const PoolOptions &opts, MemoryResource *upstream) noexcept; SWS_CORE_00030
SynchronizedPoolResource (); SWS_CORE_00031
explicit SynchronizedPoolResource (MemoryResource *upstream); SWS_CORE_00032
explicit SynchronizedPoolResource (const PoolOptions &opts); SWS_CORE_00033
SynchronizedPoolResource (const SynchronizedPoolResource &)=delete; SWS_CORE_00034
SynchronizedPoolResource (SynchronizedPoolResource &&other) noexcept=default; SWS_CORE_00043

except for the following deviations: 1. The function is not virtual ≙ [mem.res.pool]

~SynchronizedPoolResource () noexcept override;

方法

except for the following deviations: 1. The function is noexcept 2. The function returns nullptr instead of (potentially) throwing a std::bad_alloc exception ≙ std::bad_alloc

void * do_allocate (std::size_t bytes, std::size_t alignment) noexcept override;

except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored ≙ [mem.res.pool]

void do_deallocate (void *p, std::size_t bytes, std::size_t alignment) noexcept override;

≙ [mem.res.pool]

bool do_is_equal (const MemoryResource &other) const noexcept override;
options 函数

≙ [mem.res.pool]

PoolOptions options () const noexcept;
release 函数

≙ [mem.res.pool]

void release () noexcept;

≙ [mem.res.pool]

MemoryResource * upstream_resource () const noexcept;

运算符

operator= 函数 2

≙ [mem.res.pool]

重载 = 2

方法文档

函数 SynchronizedPoolResource [SWS_CORE_00030]

SynchronizedPoolResource (const PoolOptions &opts, MemoryResource *upstream) noexcept;

As per corresponding usage in [mem.res.pool]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00030
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00030@rel:R25-11#a29f6999
Content hash
a29f6999
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00030
Status: valid/unmigrated Version: rel:R25-11#1501c053 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00030@rel:R25-11#1501c053
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f8089aa92026-09-30
  • R24-11rel:R24-11#faeb22342026-10-14
  • R25-11rel:R25-11#1501c0532026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 SynchronizedPoolResource [SWS_CORE_00031]

SynchronizedPoolResource ();

As per corresponding usage in [mem.res.pool]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitnot exception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00031
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00031@rel:R25-11#67bfb023
Content hash
67bfb023
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00031
Status: valid/unmigrated Version: rel:R25-11#63c60a5b Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00031@rel:R25-11#63c60a5b
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#6a93df772026-09-30
  • R24-11rel:R24-11#be6b67802026-10-14
  • R25-11rel:R25-11#63c60a5b2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 SynchronizedPoolResource [SWS_CORE_00032]

explicit SynchronizedPoolResource (MemoryResource *upstream);

As per corresponding usage in [mem.res.pool]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitnot exception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00032
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00032@rel:R25-11#0ae889ed
Content hash
0ae889ed
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00032
Status: valid/unmigrated Version: rel:R25-11#067110c6 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00032@rel:R25-11#067110c6
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f8e2d78a2026-09-30
  • R24-11rel:R24-11#27e7852a2026-10-14
  • R25-11rel:R25-11#067110c62026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 SynchronizedPoolResource [SWS_CORE_00033]

explicit SynchronizedPoolResource (const PoolOptions &opts);

As per corresponding usage in [mem.res.pool]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitnot exception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00033
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00033@rel:R25-11#9401c63a
Content hash
9401c63a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00033
Status: valid/unmigrated Version: rel:R25-11#5b044f0f Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00033@rel:R25-11#5b044f0f
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#c83c02272026-09-30
  • R24-11rel:R24-11#7830448d2026-10-14
  • R25-11rel:R25-11#5b044f0f2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 SynchronizedPoolResource [SWS_CORE_00034]

SynchronizedPoolResource (const SynchronizedPoolResource &)=delete;

As per corresponding usage in [mem.res.pool]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00034
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00034@rel:R25-11#ddc99238
Content hash
ddc99238
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00034
Status: valid/unmigrated Version: rel:R25-11#0d5ed9ad Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00034@rel:R25-11#0d5ed9ad
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#e9c9708e2026-09-30
  • R24-11rel:R24-11#599cf30b2026-10-14
  • R25-11rel:R25-11#0d5ed9ad2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 SynchronizedPoolResource [SWS_CORE_00043] Upstream: RS_AP_00145

SynchronizedPoolResource (SynchronizedPoolResource &&other) noexcept=default;

[AUTOSAR defined] not present in ISO-14882. Move constructor

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00043
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00043@rel:R25-11#6f98bea6
Content hash
6f98bea6
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00043
Status: valid/unmigrated Version: rel:R25-11#107ef101 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00043@rel:R25-11#107ef101
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#e85c46f22026-09-30
  • R24-11rel:R24-11#ee10a8d92026-10-14
  • R25-11rel:R25-11#107ef1012026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 do_allocate [SWS_CORE_00061]

void * do_allocate (std::size_t bytes, std::size_t alignment) noexcept override;

As per corresponding usage in [mem.res.pool] except for the following deviations: 1. The function is noexcept 2. The function returns nullptr instead of (potentially) throwing a std::bad_alloc exception

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: d6b2e58cc49a 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用与分配语义

来自头文件 #include "ara/core/memory_resource.h" 的类 ara::core::SynchronizedPoolResource 的成员函数 do_allocate 用于分配具有指定字节大小 bytes 和对齐方式 alignment 的内存区域 [SWS_CORE_00061]。成功时,根据 [mem.res.pool],同步调用返回指向已分配内存块的有效类型为 void* 的指针 [SWS_CORE_00061]。

错误处理与偏差

关于错误行为,该实现显式偏离了 [mem.res.pool] 中的规定:该方法声明为 noexcept,且不触发 std::bad_alloc 异常 [SWS_CORE_00061]。在内存请求失败时,返回的指针强制为 nullptr [SWS_CORE_00061]。因此,调用方必须强制检查返回值是否为空指针,以可靠捕获分配错误。

并发性与交互

该函数被指定为 exception safe,且与其他内存资源不同,被指定为 thread-safe [SWS_CORE_00061]。由于其 protected 可见性,它在实践中大概率主要充当来自 ara::core::MemoryResource 的纯虚基类接口 do_allocate 的内部重写 [SWS_CORE_06566]。 问题 Q-95ba181693426bfc (未决)虽然 ara::core::SynchronizedPoolResource 确保了并发访问安全 [SWS_CORE_00061],但类似实现如 ara::core::UnsynchronizedPoolResource::do_allocate [SWS_CORE_00058] 和 ara::core::MonotonicBufferResource::do_allocate [SWS_CORE_06569] 均被定义为 not thread-safe。

本文由 AI 系统基于 AUTOSAR Adaptive R25-11 规范生成。

实现者指南即将推出(复杂度 I1)

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe
Sichtbarkeitprotected

Rückgabewert

TypBeschreibung
void *• If successful: As per corresponding usage in [mem.res.pool] • If unsuccessful: the returned pointer shall be nullptr

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00061
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00061@rel:R25-11#90fe8316
Content hash
90fe8316
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00061
Status: valid/unmigrated Version: rel:R25-11#7fd00d51 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00061@rel:R25-11#7fd00d51
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#e22e6db22026-09-30
  • R24-11rel:R24-11#2f88c08f2026-10-14
  • R25-11rel:R25-11#7fd00d512026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 do_deallocate [SWS_CORE_00041]

void do_deallocate (void *p, std::size_t bytes, std::size_t alignment) noexcept override;

As per corresponding usage in [mem.res.pool] except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: b07cac0de0a1 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::SynchronizedPoolResource 的受保护成员函数 do_deallocate 用于根据 [SWS_CORE_00041] 释放先前分配的内存区域。其调用以同步方式进行,并期望接收指向内存区域的指针 p、字节大小 bytes 以及内存对齐方式 alignment 作为参数。由于该成员函数声明为可见性 protected,因此在常规应用程序代码中大概率不会直接调用它,而是通过上层基类 ara::core::MemoryResource 用于释放的公共接口来执行([SWS_CORE_06567])。 问题 Q-badea921c907c214 (未决)

关于错误处理和异常行为,规范定义了两个偏离标准的强制性偏差:

  • 该函数被声明为 noexcept 且完全异常安全(exception safe)([SWS_CORE_00041])。
  • 如果释放不成功,发生的错误将被静默忽略([SWS_CORE_00041])。既不会抛出异常,也不会反馈错误码。

在并发性方面,ara::core::SynchronizedPoolResource 中的实现的特点在于它被明确指定为线程安全(thread-safe)([SWS_CORE_00041])。因此,它适用于来自多个线程的同时调用。在这点上,它与相关的资源 ara::core::UnsynchronizedPoolResource([SWS_CORE_00059])和 ara::core::MonotonicBufferResource([SWS_CORE_06570])有着本质区别,后者被归类为非线程安全。

本文由 AI 基于 AUTOSAR 规范 R25-11 生成。

实现者指南即将推出(复杂度 I1)

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe
Sichtbarkeitprotected

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00041
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00041@rel:R25-11#ad9c8281
Content hash
ad9c8281
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00041
Status: valid/unmigrated Version: rel:R25-11#c6457f44 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00041@rel:R25-11#c6457f44
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#874775232026-09-30
  • R24-11rel:R24-11#0c42970f2026-10-14
  • R25-11rel:R25-11#c6457f442026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 do_is_equal [SWS_CORE_00042]

bool do_is_equal (const MemoryResource &other) const noexcept override;

As per corresponding usage in [mem.res.pool]

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: c89ab0c97360 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

受保护的成员函数 do_is_equal 检查 ara::core::SynchronizedPoolResource 的实例与另一个内存资源 [SWS_CORE_00042] 的相等性。它根据 [mem.res.pool] 中针对池资源的规范覆盖了来自 ara::core::MemoryResource [SWS_CORE_06568] 的纯虚基类方法。

用法与接口:传递对另一个 ara::core::MemoryResource 对象的引用作为参数 (const MemoryResource &other)。类型为 bool 的返回值指示两个资源是否等价。解释:由于可见性为 protected,该函数在常规应用流程中不会被直接调用,而是通过基类的公共比较方法执行。 问题 Q-29fb2980d1241fae (未决)

错误处理与安全性:该方法使用标识符 noexcept 声明并指定为 exception safe [SWS_CORE_00042]。既不发生异常,也不出现特定错误码。执行是同步进行的。

并发性:根据 [SWS_CORE_00042],do_is_equal 被指定为 thread-safe,因此允许跨多个线程进行并发比较,而无需额外的外部同步。

交互作用:该函数构成了 ara::core::UnsynchronizedPoolResource [SWS_CORE_00060] 中实现的线程安全对等项。同样,ara::core::MonotonicBufferResource 提供了相应的覆盖,该覆盖同样被标记为 noexcept [SWS_CORE_06571]。

本文由 AI 基于 AUTOSAR Adaptive R25-11 规范生成。

实现者指南即将推出(复杂度 I1)

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe
Sichtbarkeitprotected

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00042
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00042@rel:R25-11#f041c13f
Content hash
f041c13f
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00042
Status: valid/unmigrated Version: rel:R25-11#6ecf1a68 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00042@rel:R25-11#6ecf1a68
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#0fcf0b452026-09-30
  • R24-11rel:R24-11#d999b0d62026-10-14
  • R25-11rel:R25-11#6ecf1a682026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 operator= [SWS_CORE_00036]

SynchronizedPoolResource & operator= (const SynchronizedPoolResource &)=delete;

As per corresponding usage in [mem.res.pool]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00036
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00036@rel:R25-11#1d3590cb
Content hash
1d3590cb
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00036
Status: valid/unmigrated Version: rel:R25-11#71efdb4a Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00036@rel:R25-11#71efdb4a
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#e3bdcb9c2026-09-30
  • R24-11rel:R24-11#fc1cd0a02026-10-14
  • R25-11rel:R25-11#71efdb4a2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 operator= [SWS_CORE_00044] Upstream: RS_AP_00145

SynchronizedPoolResource & operator= (SynchronizedPoolResource &&other) noexcept=default;

[AUTOSAR defined] not present in ISO-14882. Move assignment operator

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00044
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00044@rel:R25-11#dfe5dd9e
Content hash
dfe5dd9e
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00044
Status: valid/unmigrated Version: rel:R25-11#4a2251b2 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00044@rel:R25-11#4a2251b2
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#2845c0fb2026-09-30
  • R24-11rel:R24-11#9e9c91662026-10-14
  • R25-11rel:R25-11#4a2251b22026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 options [SWS_CORE_00039]

PoolOptions options () const noexcept;

As per corresponding usage in [mem.res.pool]

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 4714ac548826 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::SynchronizedPoolResource 的成员函数 options 同步返回为内存资源配置的类型为 PoolOptions 的设置 [SWS_CORE_00039]。该调用在该类的一个实例上无参数执行,并通过头文件 ara/core/memory_resource.h 声明 [SWS_CORE_00039]。根据规范,其行为参考了 [mem.res.pool] [SWS_CORE_00039],这推测可被解释为借鉴了 C++ 标准的池资源。 问题 Q-9abfddc2cf8dc88c (未决)

关于错误处理和异常安全性,该方法声明为 noexcept,被视为完全异常安全(exception safe)[SWS_CORE_00039]。对于该查询函数,不存在特定的错误代码或向 DET 或 DEM 的报告。

在并发性方面,该方法被指定为 const 且明确为线程安全(thread-safe)[SWS_CORE_00039]。因此,无需在用户层面采取额外的同步措施,即可安全地从多个线程并行调用。

在 ara::core 内的交互中,[SWS_CORE_00057] 提供了未同步的对应部分:对于 ara::core::UnsynchronizedPoolResource,存在一个名称和签名相同且根据 [mem.res.pool] 具有相同语义的函数 options。

此文本由 AI 生成,用作指导性使用帮助。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00039
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00039@rel:R25-11#6d4d04e6
Content hash
6d4d04e6
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00039
Status: valid/unmigrated Version: rel:R25-11#104880b6 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00039@rel:R25-11#104880b6
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#065c07432026-09-30
  • R24-11rel:R24-11#d92abe712026-10-14
  • R25-11rel:R25-11#104880b62026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 release [SWS_CORE_00037]

void release () noexcept;

As per corresponding usage in [mem.res.pool]

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 32c426df4959 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

同步成员函数 release() 属于类 ara::core::SynchronizedPoolResource,并通过头文件 #include "ara/core/memory_resource.h" 提供 [SWS_CORE_00037]。它具有签名 void release () noexcept;,不接受任何参数且没有返回值。其功能语义取决于 [mem.res.pool] [SWS_CORE_00037] 中的相应用法,从而释放由内存资源管理的内存。

在错误处理方面,该函数被声明为异常安全(exception safe)和 noexcept [SWS_CORE_00037]。不会发生 C++ 异常;规范范围内未定义特定的错误码或通过 DET 或 DEM 的错误报告。

关于并发性,该操作被明确指定为线程安全(thread-safe)[SWS_CORE_00037]。因此,在同一资源实例上从多个线程并发调用很可能在没有额外应用端锁的情况下是允许的。 问题 Q-3da3b45ca2070b3e (未决)

在协作中,该行为对应于 ara::core::UnsynchronizedPoolResource [SWS_CORE_00065] 中的同功能方法,该方法同样引用 [mem.res.pool],并被标明为 noexcept 以及 thread-safe。与此相反,根据规范,ara::core::MonotonicBufferResource [SWS_CORE_06530] 的类似 release() 函数不是线程安全的(not thread-safe),尽管它同样遵循 noexcept 保证。

本文本由 AI 创建,且完全基于 AUTOSAR R25-11 的规范数据。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00037
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00037@rel:R25-11#9b31a4c1
Content hash
9b31a4c1
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00037
Status: valid/unmigrated Version: rel:R25-11#e7871754 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00037@rel:R25-11#e7871754
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#adf41cb12026-09-30
  • R24-11rel:R24-11#00875b8f2026-10-14
  • R25-11rel:R25-11#e78717542026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 upstream_resource [SWS_CORE_00038]

MemoryResource * upstream_resource () const noexcept;

As per corresponding usage in [mem.res.pool]

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 6f69b7b33ad7 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类 ara::core::SynchronizedPoolResource 的成员函数 upstream_resource() 根据 [SWS_CORE_00038] 返回一个指向底层上游内存资源(MemoryResource*)的指针。调用同步进行,并且需要包含头文件 #include "ara/core/memory_resource.h" [SWS_CORE_00038]。该函数不接受任何传入参数,仅作为上一级内存管理单元的检查器。

错误处理与异常安全性

该方法被声明为 noexcept,并根据规范被归类为异常安全(exception safe)[SWS_CORE_00038]。该查询不会失败,也绝不会触发异常;此调用不存在错误码。

并发性与限制

该函数被指定为 const 并且明确为线程安全(thread-safe)[SWS_CORE_00038]。因此,它可以由多个执行上下文并发调用,而无需额外的外部同步。

相互作用

上游内存资源的概念在 AUTOSAR Adaptive Core 的各个内存池实现之间得到一致提供:

  • 在 ara::core::UnsynchronizedPoolResource 中,功能相同的方法 [SWS_CORE_00056] 同样提供指向上游资源的指针,但针对的是未在内部同步的池场景。
  • 在 ara::core::MonotonicBufferResource 中存在对应的等价项 [SWS_CORE_06531],它同样被指定为 noexcept 并且是线程安全的。

本使用说明根据 AUTOSAR 有效负载自动生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00038
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00038@rel:R25-11#70219f5b
Content hash
70219f5b
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00038
Status: valid/unmigrated Version: rel:R25-11#72bf42c6 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00038@rel:R25-11#72bf42c6
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#8f2216bb2026-09-30
  • R24-11rel:R24-11#4fe314762026-10-14
  • R25-11rel:R25-11#72bf42c62026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 ~SynchronizedPoolResource [SWS_CORE_00035]

~SynchronizedPoolResource () noexcept override;

As per corresponding usage in [mem.res.pool] except for the following deviations: 1. The function is not virtual

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::SynchronizedPoolResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00035
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00035@rel:R25-11#acc63944
Content hash
acc63944
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00035
Status: valid/unmigrated Version: rel:R25-11#ecac8c82 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00035@rel:R25-11#ecac8c82
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#7dd197ad2026-09-30
  • R24-11rel:R24-11#969d9a0a2026-10-14
  • R25-11rel:R25-11#ecac8c822026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill