Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Miosix Kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Miosix Kernel
Commits
4c7045a2
Commit
4c7045a2
authored
1 year ago
by
Federico
Browse files
Options
Downloads
Patches
Plain Diff
Fix class Queue not calling destructors for types that need it
parent
d963e7fd
Branches
Branches containing commit
Tags
before-git-migration
Tags containing commit
2 merge requests
!40
Update to Miosix 2.7
,
!17
Draft: Improved miosix build system and fixed cmake scripts
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
miosix/kernel/queue.h
+19
-6
19 additions, 6 deletions
miosix/kernel/queue.h
with
19 additions
and
6 deletions
miosix/kernel/queue.h
+
19
−
6
View file @
4c7045a2
...
...
@@ -175,11 +175,7 @@ public:
* Same as reset(), but to be used only inside IRQs or when interrupts are
* disabled.
*/
void
IRQreset
()
{
IRQwakeWaitingThread
();
putPos
=
getPos
=
numElem
=
0
;
}
void
IRQreset
();
//Unwanted methods
Queue
(
const
Queue
&
s
)
=
delete
;
...
...
@@ -290,11 +286,28 @@ bool Queue<T,len>::IRQget(T& elem, bool *hppw)
IRQwakeWaitingThread
();
if
(
isEmpty
())
return
false
;
numElem
--
;
elem
=
buffer
[
getPos
];
elem
=
std
::
move
(
buffer
[
getPos
]
)
;
if
(
++
getPos
==
len
)
getPos
=
0
;
return
true
;
}
template
<
typename
T
,
unsigned
int
len
>
void
Queue
<
T
,
len
>::
IRQreset
()
{
IRQwakeWaitingThread
();
//Relying on constant folding to omit this code for trivial types
if
(
std
::
is_trivially_destructible
<
T
>::
value
==
false
)
{
while
(
!
isEmpty
())
{
numElem
--
;
buffer
[
getPos
].
~
T
();
if
(
++
getPos
==
len
)
getPos
=
0
;
}
}
putPos
=
getPos
=
numElem
=
0
;
}
//This partial specialization is meant to to produce compiler errors in case an
//attempt is made to instantiate a Queue with zero size, as it is forbidden
template
<
typename
T
>
class
Queue
<
T
,
0
>
{};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment