Commit Graph

21 Commits (72d2f40bfffeacba4689a816ef03427151b6da4c)

Author SHA1 Message Date
Kevin Bracey d6a48b5124 Turn NULLs into nullptr
Avoids overload problems with Callback(nullptr) versus Callback(fnptr).
2020-01-09 14:52:54 +02:00
Martin Kojtal 222d31c2b6
Merge pull request #12037 from kjbracey-arm/sharedptr_move
SharedPtr: add move operations
2020-01-09 12:03:45 +01:00
Kevin Bracey 2b4b7232b7 SharedPtr: add nullptr constructor
For consistency with `std::shared_ptr`, and `mbed::Callback`, and as a
potential optimisation aid, give `SharedPtr` a distinct constructor for
`nullptr`.
2019-12-09 11:37:06 +02:00
Kevin Bracey 678ec0f3fb SharedPtr: add move operations
Optimise SharedPtr by giving it move constructor and assignment
operator.
2019-12-09 10:10:44 +02:00
Kevin Bracey 87396e0bf6 Assembler atomics
Reimplement atomic code in inline assembly. This can improve
optimisation, and avoids potential architectural problems with using
LDREX/STREX intrinsics.

API further extended:
* Bitwise operations (fetch_and/fetch_or/fetch_xor)
* fetch_add and fetch_sub (like incr/decr, but returning old value -
  aligning with C++11)
* compare_exchange_weak
* Explicit memory order specification
* Basic freestanding template overloads for C++

This gives our existing C implementation essentially all the functionality
needed by C++11.

An actual Atomic<T> template based upon these C functions could follow.
2019-04-26 13:12:35 +03:00
Martin Kojtal 6684570dea
Merge pull request #9580 from kjbracey-arm/sharedptr_reset
Fix SharedPtr::reset
2019-02-04 14:41:34 +01:00
Kevin Bracey 52aac4c756 SharedPtr: use atomic load
Use atomic load to read use count.
2019-02-01 12:31:41 +02:00
Kevin Bracey 0b27c9149e Fix SharedPtr::reset
SharedPtr::reset did not actually set the stored pointer value.
Correct this, with other minor tidies:

* Ensure counter is set to NULL if pointer is reset to NULL
* Be consistent about not clearing pointers in decrement_counter().
2019-02-01 10:34:34 +02:00
Martin Kojtal ad759b7749 platform: add spdx license 2018-11-28 10:39:52 +00:00
kegilbert 766359c7c5 Typo fixes in Doxygen for Platform 2018-11-01 12:10:08 -05:00
paul-szczepanek-arm e4f3768c6c protect using with macro 2018-10-26 08:41:58 +01:00
paul-szczepanek-arm 05a4337490 make it backwards compatible 2018-10-04 16:12:26 +01:00
paul-szczepanek-arm 3a408eb85a fix missing namespace mbed 2018-10-04 15:51:01 +01:00
Donatien Garnier 298f847821 Fix use_count() in SharedPtr 2018-08-21 12:59:54 +01:00
Amanda Butler 7086d69a83
Copy edit SharedPtr.h
Copy edit for consistent capitalization and minor grammar nits.
2018-08-20 13:55:21 -05:00
Donatien Garnier d9c1748c14 Update formatting for SharedPtr.h 2018-08-20 12:04:53 +01:00
Donatien Garnier 6f3c07f6eb Optimize SharedPtr code 2018-08-17 20:11:00 +01:00
Donatien Garnier ac79b007d0 Cleanup description 2018-08-17 19:05:19 +01:00
Donatien Garnier 2608478e87 Cleanup shared pointer implementation and add reset() methods 2018-08-17 18:45:01 +01:00
Donatien Garnier f45642cec0 Make shared pointer thread safe and clean-up class and doc 2018-08-17 18:25:28 +01:00
Donatien Garnier 9ebfbc0cdd Re-introduce a shared pointer class in mbed OS 2018-08-17 12:30:51 +01:00