This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

[gold patch] Fix thread cancellation problem


If the number of threads requested for --thread-count-middle or
--thread-count-final is smaller than that of an earlier pass, gold
will arrange for the n excess threads to cancel themselves. The first
n threads that happen to check for this condition will terminate.
Unfortunately, if one of those n threads happens to be thread #0,
control returns to the end of main(), and gold exits normally without
completing the link.

This patch fixes this problem by having only the threads whose thread
numbers are larger than the desired thread count terminate.

Tested on x86_64 with a build of libffmpeg.

OK?

-cary

	* workqueue-internal.h (Workqueue_threader::should_cancel_thread):
	Add thread_number parameter.
	(Workqueue_threader_threadpool::should_cancel_thread): Likewise.
	* workqueue-threads.cc
	(Workqueue_threader_threadpool::should_cancel_thread): Cancel
	current thread if its thread number is greater than desired thread
	count.
	* workqueue.cc (Workqueue_threader_single::should_cancel_thread):
	Add thread_number parameter.
	(Workqueue::should_cancel_thread): Likewise.
	(Workqueue::find_runnable_or_wait): Pass thread_number to
	should_cancel_thread.
	* workqueue.h (Workqueue::should_cancel_thread): Add thread_number
	parameter.

Attachment: gold-thread-cancel-patch.txt
Description: Text document


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