Skip to content

Commit

Permalink
fixing bug in thread_cancellation class
Browse files Browse the repository at this point in the history
when destroying a thread_cancellation object on a thread which was requested
to be cancelled, the status was kept forever in the preborn list, which purpose
is not for that but to record cancellation for thread which no thread_cancellation
object was yet run.

just deleting thread_cancellation reference from the info list is better, the
cancellation information for that tid will be forgotten once all thread_cancellation
object for that thread will be deleted.
  • Loading branch information
Edrusb committed Dec 4, 2024
1 parent 260b0a1 commit 093ad18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/build/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ from 2.7.15 to 2.7.16
more than the half of kept entries...
- adding kdf support for repairing operation instead of using the values of the
archive/backup under reparation.

- fixing bug in thread_cancellation class that led a cancelled thread kept
being recorded as cancelled forever, leading libdar to abort immediately when
run in a new thread having the the same tid.

from 2.7.14 to 2.7.15
- updating libdar about CURLINFO_CONTENT_LENGTH_DOWNLOAD symbol which is
Expand Down
6 changes: 1 addition & 5 deletions src/libdar/thread_cancellation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace libdar
status.cancellation = false;
status.flag = 0;
}
else // pending cancellation for that thread
else // pending cancellation information for that thread
{
status = *it;
preborn.erase(it);
Expand Down Expand Up @@ -118,11 +118,7 @@ namespace libdar
if(*ptr == nullptr)
bug = true;
else
{
if((*ptr)->status.cancellation) // cancellation for that thread
preborn.push_back((*ptr)->status);
info.erase(ptr);
}
CRITICAL_END;

if(bug)
Expand Down

0 comments on commit 093ad18

Please sign in to comment.