Skip to content
Snippets Groups Projects
Commit 98b79fad authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: avoid potential deadlock when resizing from zero-sized list

- not yet triggered by any code, but avoid anyhow
parent c2123452
No related branches found
No related tags found
No related merge requests found
...@@ -163,6 +163,8 @@ inline T& Foam::List<T>::newElmt(const label i) ...@@ -163,6 +163,8 @@ inline T& Foam::List<T>::newElmt(const label i)
if (i >= n) if (i >= n)
{ {
if (!n) n = 1; // Avoid dead-lock when starting from zero-sized
do do
{ {
n *= 2; n *= 2;
......
...@@ -114,8 +114,10 @@ void Foam::ITstream::reserveCapacity ...@@ -114,8 +114,10 @@ void Foam::ITstream::reserveCapacity
label n = tokenList::size(); label n = tokenList::size();
if (nElem >= n) if (nElem > n)
{ {
if (!n) n = 1; // Avoid dead-lock when starting from zero-sized
do do
{ {
n *= 2; n *= 2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment