nrn icon indicating copy to clipboard operation
nrn copied to clipboard

Make MutexPool an allocator

Open alkino opened this issue 2 years ago • 15 comments

Move structpool.h to utils/pool.hpp Move nrncvode/pool.h in utils/mutexed_pool.hpp.

The new pools is neuron-agnostic (hoc, ...).

To create a normal pool: Pool<int> To create a pool protected with mutex: MutexedPool<int>, the type of the mutex can be given as a second optional argument (by default std::mutex) MutexedPool<int, std::recursive_mutex>

To follow https://en.cppreference.com/w/cpp/named_req/Allocator:

  • Rename alloc to allocate
  • Rename hpfree to deallocate

The function to clean the data has to be set with set_function it lets us, use a different name, a lambda, a free function, ... compare to before where the function should be part of the type and named clear().

alkino avatar Mar 01 '24 11:03 alkino

✔️ d72251f281ba307b70c79bfc804ae8f219c10f77 -> Azure artifacts URL

azure-pipelines[bot] avatar Mar 18 '24 09:03 azure-pipelines[bot]

Codecov Report

Attention: Patch coverage is 89.18919% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 67.14%. Comparing base (2b928ad) to head (cc18266). Report is 1 commits behind head on master.

Files Patch % Lines
src/utils/pool.hpp 80.95% 8 Missing :warning:
src/nrncvode/tqueue.cpp 87.50% 1 Missing :warning:
src/nrniv/cxprop.cpp 75.00% 1 Missing :warning:
src/nrniv/multisend.cpp 80.00% 1 Missing :warning:
src/utils/mutexed_pool.hpp 97.61% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2766      +/-   ##
==========================================
- Coverage   67.15%   67.14%   -0.01%     
==========================================
  Files         562      561       -1     
  Lines      104118   104073      -45     
==========================================
- Hits        69923    69885      -38     
+ Misses      34195    34188       -7     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 18 '24 10:03 codecov[bot]

✔️ 4a12b5776fc274bd68cae082c536bebc2d30e829 -> Azure artifacts URL

azure-pipelines[bot] avatar Mar 21 '24 10:03 azure-pipelines[bot]

✔️ 2b1719ad36aa1137ab71f3aacc4da306dcef6395 -> Azure artifacts URL

azure-pipelines[bot] avatar Mar 26 '24 13:03 azure-pipelines[bot]

✔️ 0936befd55a495d3b5c17451937d12d1d57bd704 -> Azure artifacts URL

azure-pipelines[bot] avatar Mar 26 '24 15:03 azure-pipelines[bot]

✔️ cc1826600de5f222ce828710f62f6086a1405ee8 -> Azure artifacts URL

azure-pipelines[bot] avatar Apr 11 '24 09:04 azure-pipelines[bot]