This is the mail archive of the 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] Fix race conditions related to independent tasks

This patch fixes several race conditions involving independent tasks.
The main thing is to make sure the activating task waits for them
to become independent. Otherwise (for example) the environment task
can race ahead to Finalize_Global_Tasks and find things in an
inconsistent state, causing programs to intermittently hang.

In addition, we fix several data structures used by various independent tasks
to be reliably initialized before those tasks get activated.

No simple test case is available.

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

2014-07-30  Bob Duff  <>

	*, s-tasuti.adb (Make_Independent): Change this
	from a procedure to a function, so that it can more easily be
	called before the "begin" of a task.
	* (Delay_Block): Make this type immutably limited,
	so we can use a build-in-place function call to initialize
	Timer_Queue in the body.
	* a-rttiev.adb, s-asthan-vms-alpha.adb, s-asthan-vms-ia64.adb,
	* s-interr.adb, s-interr-hwint.adb, s-interr-sigaction.adb,
	* s-interr-vms.adb, s-taasde.adb: Each independent task now calls
	Make_Independent before reaching its "begin", to avoid race
	conditions. This causes the activating task to wait until after
	Make_Independent is complete before proceeding.  In addition,
	we initialize data structures used by independent tasks before
	activating those tasks, to avoid possible use of uninitialized data.
	Minor comment fixes.

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]