mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-15 11:00:04 +08:00
3cb62bd614
* dcrt0.cc (dll_crt0_1): Just wait for signal thread to go live rather than going through the overhead of invoking it. * fork.cc (fork_child): Ditto. * exceptions.cc (signal_fixup_after_fork): Call sigproc_init here. * sigproc.cc (proc_can_be_signalled): Assume that the signal thread is live. (sig_dispatch): Ditto. (sig_send): Ditto. (wait_for_sigthread): Renamed from "wait_for_me". Assume that wait_sig_inited has been set and that this function is only called from the main thread. * winsup.h (wait_for_sigthread): Declare new function.
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
/* assert.cc: Handle the assert macro for WIN32.
|
|
|
|
Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.
|
|
|
|
This file is part of Cygwin.
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
details. */
|
|
|
|
#include "winsup.h"
|
|
#include "security.h"
|
|
#include <wingdi.h>
|
|
#include <winuser.h>
|
|
|
|
#include <assert.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
/* This function is called when the assert macro fails. This will
|
|
override the function of the same name in newlib. */
|
|
|
|
extern "C" void
|
|
__assert (const char *file, int line, const char *failedexpr)
|
|
{
|
|
HANDLE h;
|
|
|
|
/* If we don't have a console in a Windows program, then bring up a
|
|
message box for the assertion failure. */
|
|
|
|
h = CreateFileA ("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, &sec_none_nih,
|
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
if (h == INVALID_HANDLE_VALUE || h == 0)
|
|
{
|
|
char *buf;
|
|
|
|
buf = (char *) alloca (100 + strlen (failedexpr));
|
|
__small_sprintf (buf, "Failed assertion\n\t%s\nat line %d of file %s",
|
|
failedexpr, line, file);
|
|
MessageBox (NULL, buf, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
|
|
}
|
|
else
|
|
{
|
|
CloseHandle (h);
|
|
small_printf ("assertion \"%s\" failed: file \"%s\", line %d\n",
|
|
failedexpr, file, line);
|
|
}
|
|
|
|
#ifdef DEBUGGING
|
|
try_to_debug ();
|
|
#endif
|
|
abort (); // FIXME: Someday this should work.
|
|
|
|
/* NOTREACHED */
|
|
}
|