Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SSD1306_smart_watch
Fork of mbed-src by
Diff: common/CallChain.cpp
- Revision:
- 36:ab3ee77451e7
- Parent:
- 15:4892fe388435
- Child:
- 212:34d62c0b2af6
--- a/common/CallChain.cpp Mon Oct 21 11:45:04 2013 +0100
+++ b/common/CallChain.cpp Wed Oct 23 14:15:04 2013 +0100
@@ -38,13 +38,11 @@
}
void CallChain::clear() {
- __disable_irq();
for(int i = 0; i < _elements; i ++) {
delete _chain[i];
_chain[i] = NULL;
}
_elements = 0;
- __enable_irq();
}
bool CallChain::remove(pFunctionPointer_t f) {
@@ -52,12 +50,10 @@
if ((i = find(f)) == -1)
return false;
- __disable_irq();
if (i != _elements - 1)
memmove(_chain + i, _chain + i + 1, (_elements - i - 1) * sizeof(pFunctionPointer_t));
delete f;
_elements --;
- __enable_irq();
return true;
}
@@ -69,13 +65,11 @@
void CallChain::_check_size() {
if (_elements < _size)
return;
- __disable_irq();
_size = (_size < 4) ? 4 : _size + 4;
pFunctionPointer_t* new_chain = new pFunctionPointer_t[_size]();
memcpy(new_chain, _chain, _elements * sizeof(pFunctionPointer_t));
delete _chain;
_chain = new_chain;
- __enable_irq();
}
pFunctionPointer_t CallChain::common_add(pFunctionPointer_t pf) {
@@ -87,11 +81,9 @@
pFunctionPointer_t CallChain::common_add_front(pFunctionPointer_t pf) {
_check_size();
- __disable_irq();
memmove(_chain + 1, _chain, _elements * sizeof(pFunctionPointer_t));
_chain[0] = pf;
_elements ++;
- __enable_irq();
return pf;
}
