Files
sdk/runtime/bin/thread.h
Ryan Macnak 0c3606f0ec [vm] Systematically check for failure to start thread.
Improve error message to include the intended thread name and strerror.

TEST=ci
Change-Id: Iba61a40b312f6574e8e352d51a0c3de535f6a0c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386361
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-09-24 22:41:40 +00:00

43 lines
1.3 KiB
C++

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_BIN_THREAD_H_
#define RUNTIME_BIN_THREAD_H_
#include "platform/globals.h"
#include "platform/synchronization.h"
namespace dart {
namespace bin {
class Thread {
public:
typedef void (*ThreadStartFunction)(uword parameter);
// Start a thread running the specified function. Returns 0 if the
// thread started successfully and a system specific error code if
// the thread failed to start.
DART_WARN_UNUSED_RESULT static int TryStart(const char* name,
ThreadStartFunction function,
uword parameter);
// Start a thread running the specified function. If the thread fails to
// start, then exit with an descriptive error message.
static void Start(const char* name,
ThreadStartFunction function,
uword parameter);
static intptr_t GetMaxStackSize();
static void InitOnce();
private:
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(Thread);
};
} // namespace bin
} // namespace dart
#endif // RUNTIME_BIN_THREAD_H_