µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
memory-resource.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2016-2023 Liviu Ionescu. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software
7 * for any purpose is hereby granted, under the terms of the MIT license.
8 *
9 * If a copy of the license was not distributed with this file, it can
10 * be obtained from https://opensource.org/licenses/mit/.
11 */
12
13/*
14 * [Partly inspired from the LLVM libcxx sources].
15 * Copyright (c) 2009-2013 by the contributors listed in
16 * 'LLVM libcxx Credits.txt'. See 'LLVM libcxx License.txt' for details.
17 *
18 * References are to ISO/IEC 14882:2011(E) Third edition (2011-09-01).
19 */
20
21#include <cmsis-plus/rtos/os.h>
23
24// ----------------------------------------------------------------------------
25
26#if defined(__clang__)
27#pragma clang diagnostic ignored "-Wc++98-compat"
28#endif
29
30// ----------------------------------------------------------------------------
31
32using namespace os;
33
34// ----------------------------------------------------------------------------
35
36namespace os
37{
38 namespace estd
39 {
40 // ========================================================================
41
42 [[noreturn]] void
44 {
45#if defined(__EXCEPTIONS)
46 throw std::bad_alloc ();
47#else
48 trace::printf ("bad_alloc()\n");
49 std::abort ();
50#endif
51 }
52
53 namespace pmr
54 {
55 // ----------------------------------------------------------------------
56
59 {
60 trace::printf ("estd::pmr::%s(%p) \n", __func__, res);
61
63 default_resource = res;
64
65 return old;
66 }
67
68 // ------------------------------------------------------------------------
69 } /* namespace pmr */
70 } /* namespace estd */
71} /* namespace os */
72
73// ----------------------------------------------------------------------------
Memory resource manager (abstract class).
Definition os-memory.h:160
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:60
memory_resource * set_default_resource(memory_resource *res) noexcept
Set the default application memory manager.
memory_resource * default_resource
void __throw_bad_alloc(void)
System namespace.
Single file µOS++ RTOS definitions.