YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
SegFault.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include "SegFault.h"
7
8#include <yarp/os/Log.h>
10#include <yarp/os/LogStream.h>
11#include <yarp/os/Time.h>
12
13namespace {
14YARP_LOG_COMPONENT(SEGFAULT, "yarp.device.test_segfault")
15}
16
20
24
26{
27 if (!this->parseParams(config)) { return false; }
28
29 yCInfo(SEGFAULT) << "Starting thread";
30 start();
31 yCInfo(SEGFAULT) << "Thread started";
32
33 return true;
34}
35
37{
38 return true;
39}
40
42{
43 yCInfo(SEGFAULT) << "Waiting for" << m_delay << "seconds before crashing";
45 yCWarning(SEGFAULT) << "Crashing";
46 *(int*) 0 = 0;
47}
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool close() override
Close the DeviceDriver.
Definition SegFault.cpp:36
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition SegFault.cpp:25
void run() override
Main body of the new thread.
Definition SegFault.cpp:41
~SegFault() override
Definition SegFault.cpp:21
A base class for nested structures that can be searched.
Definition Searchable.h:31
bool start()
Start the new thread running.
Definition Thread.cpp:93
#define yCInfo(component,...)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111