Merge pull request #85278 from al45tair/add-fatal-error-6.2.1

[Observation] Add threading fatal error handler.
This commit is contained in:
Mishal Shah
2025-11-03 16:40:08 -08:00
committed by GitHub
2 changed files with 27 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ add_swift_target_library(swiftObservation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS
ObservationRegistrar.swift ObservationRegistrar.swift
ObservationTracking.swift ObservationTracking.swift
Observations.swift Observations.swift
ThreadingError.cpp
ThreadLocal.cpp ThreadLocal.cpp
ThreadLocal.swift ThreadLocal.swift

View File

@@ -0,0 +1,26 @@
//===--- ThreadingError.cpp - Error handling support code -----------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#include "swift/Threading/Errors.h"
#include <cstdio>
#include <cstdlib>
// Handle fatal errors from the threading library
SWIFT_ATTRIBUTE_NORETURN
SWIFT_FORMAT(1, 2)
void swift::threading::fatal(const char *format, ...) {
va_list val;
va_start(val, format);
vfprintf(stderr, format, val);
abort();
}