mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Instead of always calling waitpid() and looking for the termination of a task, call poll() and watch for events on the pipes which are used for buffering subtask output. When we receive a POLLIN or POLLPRI event, ask the corresponding Task to read from the pipe; when we receive a POLLHUP or POLLERR event, wait for the subtask to finish and then ask the Task to perform its post-execution tasks. Now that the Unix implementation properly handles large amounts of subtask output, re-enable the Unix implementation (if supported). This fixes <rdar://problem/15795234>. Swift SVN r12293
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
//===--- TaskQueue.cpp - Task Execution Work Queue ------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// \brief This file includes the appropriate platform-specific TaskQueue
|
|
/// implementation (or the default serial fallback if one is not available),
|
|
/// as well as any platform-agnostic TaskQueue functionality.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "swift/Basic/TaskQueue.h"
|
|
|
|
using namespace swift;
|
|
using namespace swift::sys;
|
|
|
|
// Include the correct TaskQueue implementation.
|
|
#if LLVM_ON_UNIX
|
|
#include "Unix/TaskQueue.inc"
|
|
#else
|
|
#include "Default/TaskQueue.inc"
|
|
#endif
|
|
|
|
TaskQueue::TaskQueue(unsigned NumberOfParallelTasks)
|
|
: NumberOfParallelTasks(NumberOfParallelTasks) {}
|
|
|
|
TaskQueue::~TaskQueue() = default;
|