This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Race condition in allocator with finalization


This patch fixes a race condition in an allocator for a type that needs
finalization. The race condition is unlikely to occur in practice;
it occurs when the allocator is in a Finalize that occurs after the
corresponding master has already started its finalization. Finalize
operations often deallocate memory, but rarely allocate.

However, this fix is also an efficiency improvement, because it reduces the
number of lock/unlock calls.

No test is available; it's too hard to force the race condition to happen.

Tested on x86_64-pc-linux-gnu, committed on trunk

2016-05-02  Bob Duff  <duff@adacore.com>

	* s-stposu.adb (Allocate_Any_Controlled): Don't lock/unlock twice.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]