051e84c4b4
This commit introduces the new `Component` interface in the form of the headers base/component.h and base/entrypoint.h. The os/server.h API has become merely a compatibilty wrapper and will eventually be removed. The same holds true for os/signal_rpc_dispatcher.h. The mechanism has moved to base/signal.h and is now called 'Signal_handler'. Since the patch shuffles headers around, please do a 'make clean' in the build directory. Issue #1832
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
/*
|
|
* \brief Test if the exception mechanism works in hybrid applications
|
|
* \author Christian Prochaska
|
|
* \date 2011-11-22
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2011-2013 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
/* Genode includes */
|
|
#include <base/component.h>
|
|
#include <base/printf.h>
|
|
|
|
/* Linux includes */
|
|
#include <stdlib.h>
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
class Test_exception { };
|
|
|
|
static int exit_status;
|
|
static void exit_on_suspended() { exit(exit_status); }
|
|
|
|
|
|
Genode::size_t Component::stack_size() { return 16*1024*sizeof(long); }
|
|
char const * Component::name() { return "lx_hybrid_exception"; }
|
|
|
|
|
|
/*
|
|
* Component implements classical main function in construct.
|
|
*/
|
|
void Component::construct(Genode::Environment &env)
|
|
{
|
|
printf("--- lx_hybrid exception test ---\n");
|
|
|
|
try {
|
|
printf("Throwing Test_exception\n");
|
|
throw Test_exception();
|
|
} catch (Test_exception) {
|
|
printf("Caught Test_exception\n");
|
|
}
|
|
|
|
printf("--- returning from main ---\n");
|
|
exit_status = 0;
|
|
env.ep().schedule_suspend(exit_on_suspended, nullptr);
|
|
}
|