Skip to content

Commit

Permalink
Partially Revert Revert PR#554 and only leave the part of adding logs (
Browse files Browse the repository at this point in the history
…#634) (#703)

b/234788479

(cherry picked from commit ea5713e)

Co-authored-by: Sherry Zhou <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and sherryzy committed Jun 26, 2023
1 parent a1b4bed commit e78cd4a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion base/single_thread_task_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "base/debug/stack_trace.h"
#include "base/single_thread_task_runner.h"
#include "base/message_loop/message_loop.h"
#include "base/synchronization/waitable_event.h"
Expand Down Expand Up @@ -47,7 +48,15 @@ void SingleThreadTaskRunner::PostBlockingTask(const base::Location& from_here,

if (task_may_run) {
// Wait for the task to complete before proceeding.
task_finished.Wait();
do {
if (task_finished.TimedWait(base::TimeDelta::FromMilliseconds(1000))) {
break;
}
#if !defined(COBALT_BUILD_TYPE_GOLD)
base::debug::StackTrace trace;
trace.PrintWithPrefix("[task runner deadlock]");
#endif // !defined(COBALT_BUILD_TYPE_GOLD)
} while (true);
}
}
#endif
Expand Down

0 comments on commit e78cd4a

Please sign in to comment.