base: remove Thread_deprecated

Fixes #3954
This commit is contained in:
Alexander Boettcher 2020-11-23 10:03:31 +01:00 committed by Christian Helmuth
parent dbcb1ff480
commit 774b1f4277
20 changed files with 38 additions and 294 deletions

View File

@ -115,7 +115,7 @@ void Irq_object::entry()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
Thread(Weight::DEFAULT_WEIGHT, "irq", 4096 /* stack */, Type::NORMAL),
_irq(irq)
{ }

View File

@ -44,11 +44,15 @@ using namespace Genode;
/**
* Dispatches interrupts from kernel
*/
class Genode::Interrupt_handler : public Thread_deprecated<2048*sizeof(long)>
class Genode::Interrupt_handler : public Thread
{
private:
Interrupt_handler() : Thread_deprecated("irq_handler") { start(); }
Interrupt_handler()
:
Thread(Weight::DEFAULT_WEIGHT, "irq_handler",
2048 * sizeof(long) /* stack */, Type::NORMAL)
{ start(); }
public:

View File

@ -102,8 +102,10 @@ void Pager_entrypoint::dissolve(Pager_object &o)
Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &)
: Thread_deprecated<PAGER_EP_STACK_SIZE>("pager_ep"),
_kobj(true)
:
Thread(Weight::DEFAULT_WEIGHT, "pager_ep", PAGER_EP_STACK_SIZE,
Type::NORMAL),
_kobj(true)
{ start(); }

View File

@ -194,7 +194,7 @@ class Genode::Pager_object : private Object_pool<Pager_object>::Entry,
class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
public Thread_deprecated<PAGER_EP_STACK_SIZE>,
public Thread,
private Ipc_pager
{
private:

View File

@ -19,7 +19,7 @@
namespace Genode { class Irq_object; };
class Genode::Irq_object : public Thread_deprecated<4096>
class Genode::Irq_object : public Thread
{
private:

View File

@ -50,7 +50,7 @@ Irq_session::Info Irq_session_component::info()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
Thread(Weight::DEFAULT_WEIGHT, "irq", 4096 /* stack */, Type::NORMAL),
_sig_cap(Signal_context_capability()), _irq(irq), _fd(-1)
{
warning(__func__, " not implemented");

View File

@ -59,7 +59,7 @@ Irq_session::Info Irq_session_component::info()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
Thread(Weight::DEFAULT_WEIGHT, "irq", 4096 /* stack */, Type::NORMAL),
_sig_cap(Signal_context_capability()), _irq(irq), _fd(-1)
{ }

View File

@ -17,12 +17,12 @@
enum { STACK_SIZE = 4096 };
struct Thread : Genode::Thread_deprecated<STACK_SIZE>
struct Thread : Genode::Thread
{
Genode::Blockade &_barrier;
Thread(Genode::Blockade &barrier)
: Genode::Thread_deprecated<STACK_SIZE>("stat"), _barrier(barrier) { start(); }
Thread(Genode::Blockade &barrier, Genode::Env &env)
: Genode::Thread(env, "stat", STACK_SIZE), _barrier(barrier) { start(); }
void entry() override
{
@ -62,7 +62,7 @@ void Component::construct(Genode::Env &env)
Genode::log("main: before thread creation, errno=", orig_errno);
/* create thread, which modifies its thread-local errno value */
static Thread thread(barrier);
static Thread thread(barrier, env);
/* block until the thread performed a 'stat' syscall */
barrier.block();

View File

@ -117,7 +117,7 @@ void Irq_object::entry()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
Thread(Weight::DEFAULT_WEIGHT, "irq", 4096 /* stack */, Type::NORMAL),
_irq(irq)
{ }

View File

@ -115,7 +115,7 @@ void Irq_object::entry()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
Thread(Weight::DEFAULT_WEIGHT, "irq", 4096 /* stack */, Type::NORMAL),
_irq(irq)
{ }

View File

@ -20,7 +20,7 @@
namespace Genode { class Irq_object; }
class Genode::Irq_object : public Thread_deprecated<4096> {
class Genode::Irq_object : public Thread {
private:

View File

@ -156,12 +156,12 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry
class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
public Thread_deprecated<PAGER_EP_STACK_SIZE>
public Thread
{
private:
Ipc_pager _pager { };
Rpc_cap_factory _cap_factory;
Ipc_pager _pager { };
Rpc_cap_factory &_cap_factory;
Untyped_capability _pager_object_cap(unsigned long badge);
@ -176,7 +176,8 @@ class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
*/
Pager_entrypoint(Rpc_cap_factory &cap_factory)
:
Thread_deprecated<PAGER_EP_STACK_SIZE>("pager_ep"),
Thread(Weight::DEFAULT_WEIGHT, "pager_ep", PAGER_EP_STACK_SIZE,
Type::NORMAL),
_cap_factory(cap_factory)
{ start(); }

View File

@ -91,7 +91,7 @@ void Irq_object::ack_irq()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
Thread(Weight::DEFAULT_WEIGHT, "irq", 4096 /* stack */, Type::NORMAL),
_irq(irq),
_kernel_irq_sel(platform_specific().core_sel_alloc().alloc()),
_kernel_notify_sel(platform_specific().core_sel_alloc().alloc())

View File

@ -442,64 +442,4 @@ class Genode::Thread
Affinity::Location affinity() const { return _affinity; }
};
template <unsigned STACK_SIZE>
class Genode::Thread_deprecated : public Thread
{
public:
/**
* Constructor
*
* \param weight weighting regarding the CPU session quota
* \param name thread name (for debugging)
* \param type enables selection of special construction
*/
explicit Thread_deprecated(size_t weight, const char *name)
: Thread(weight, name, STACK_SIZE, Type::NORMAL) { }
/**
* Constructor
*
* \param weight weighting regarding the CPU session quota
* \param name thread name (for debugging)
* \param type enables selection of special construction
*
* \noapi
*/
explicit Thread_deprecated(size_t weight, const char *name, Type type)
: Thread(weight, name, STACK_SIZE, type) { }
/**
* Constructor
*
* \param weight weighting regarding the CPU session quota
* \param name thread name (for debugging)
* \param cpu_session thread created via specific cpu session
*
* \noapi
*/
explicit Thread_deprecated(size_t weight, const char *name,
Cpu_session * cpu_session)
: Thread(weight, name, STACK_SIZE, Type::NORMAL, cpu_session) { }
/**
* Shortcut for 'Thread(DEFAULT_WEIGHT, name, type)'
*
* \noapi
*/
explicit Thread_deprecated(const char *name, Type type = NORMAL)
: Thread(Weight::DEFAULT_WEIGHT, name, STACK_SIZE, type) { }
/**
* Shortcut for 'Thread(DEFAULT_WEIGHT, name, cpu_session)'
*
* \noapi
*/
explicit Thread_deprecated(const char *name, Cpu_session * cpu_session)
: Thread(Weight::DEFAULT_WEIGHT, name, STACK_SIZE,
Type::NORMAL, cpu_session)
{ }
};
#endif /* _INCLUDE__BASE__THREAD_H_ */

View File

@ -18,7 +18,7 @@
namespace Genode { class Irq_object; }
class Genode::Irq_object : public Thread_deprecated<4096> {
class Genode::Irq_object : public Thread {
private:

View File

@ -163,7 +163,7 @@ class Genode::Pager_object : public Object_pool<Pager_object>::Entry
class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
public Thread_deprecated<PAGER_EP_STACK_SIZE>
public Thread
{
private:
@ -183,7 +183,8 @@ class Genode::Pager_entrypoint : public Object_pool<Pager_object>,
*/
Pager_entrypoint(Rpc_cap_factory &cap_factory)
:
Thread_deprecated<PAGER_EP_STACK_SIZE>("pager_ep"),
Thread(Weight::DEFAULT_WEIGHT, "pager_ep", PAGER_EP_STACK_SIZE,
Type::NORMAL),
_cap_factory(cap_factory)
{ start(); }

View File

@ -56,7 +56,7 @@ extern unsigned char __initial_stack_base[];
/**
* The first thread in a program
*/
class Main_thread : public Thread_deprecated<MAIN_THREAD_STACK_SIZE>
class Main_thread : public Thread
{
public:
@ -67,7 +67,8 @@ class Main_thread : public Thread_deprecated<MAIN_THREAD_STACK_SIZE>
*/
Main_thread(bool reinit)
:
Thread_deprecated("main", reinit ? REINITIALIZED_MAIN : MAIN)
Thread(Weight::DEFAULT_WEIGHT, "main", MAIN_THREAD_STACK_SIZE,
reinit ? Type::REINITIALIZED_MAIN : Type::MAIN)
{ }
/**********************

View File

@ -84,9 +84,9 @@ class Timer::Threaded_time_source : public Genode::Time_source,
virtual Result_of_wait_for_irq _wait_for_irq() = 0;
/***********************
** Thread_deprecated **
***********************/
/************
** Thread **
************/
void entry() override
{

View File

@ -1,200 +0,0 @@
/*
* \brief Minimal HTTP server/client lwIP loopback demonstration
* \author lwIP Team
* \author Stefan Kalkowski
* \date 2009-10-23
*
* This example is used to show to you the usage of the loopback device
* in LwIP, as well as how to initialize the LwIP stack by hand.
* Note: if you simply want to use the LwIP stack together with the
* nic-driver in Genode, you should have a look at another example,
* e.g.: the small http-server
*/
/*
* Copyright (C) 2009-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* Genode includes */
#include <base/log.h>
#include <base/thread.h>
#include <util/string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
static const char *http_get_request =
"GET / HTTP/1.0\r\nHost: localhost:80\r\n\r\n"; /* simple HTTP request header */
/**
* The client thread simply loops endless,
* and sends as much 'http get' requests as possible,
* printing out the response.
*/
class Client : public Genode::Thread_deprecated<4096>
{
public:
Client() : Thread_deprecated("client") { }
void entry()
{
/* client loop */
while(true) {
Genode::log("Create new socket ...");
int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s < 0) {
Genode::error("no socket available!");
continue;
}
Genode::log("Connect to server ...");
struct sockaddr_in addr;
addr.sin_port = htons(80);
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
if((connect(s, (struct sockaddr *)&addr, sizeof(addr))) < 0) {
Genode::error("could not connect!");
close(s);
continue;
}
Genode::log("Send request...");
unsigned long bytes = send(s, (char*)http_get_request,
Genode::strlen(http_get_request), 0);
if ( bytes < 0 ) {
Genode::error("couldn't send request ...");
close(s);
continue;
}
/* Receive http header and content independently in 2 packets */
for(int i=0; i<2; i++) {
char buf[1024];
ssize_t buflen;
buflen = recv(s, buf, 1024, 0);
if(buflen > 0) {
buf[buflen] = 0;
Genode::log("Packet received!");
Genode::log("Packet content:\n", Genode::Cstring(buf));
} else
break;
}
/* Close socket */
close(s);
}
}
};
const static char http_html_hdr[] =
"HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"; /* HTTP response header */
const static char http_index_html[] =
"<html><head><title>Congrats!</title></head><body><h1>Welcome to our lwIP HTTP server!</h1><p>This is a small test page.</body></html>"; /* HTML page*/
/**
* Handle a single client's request.
*
* \param conn socket connected to the client
*/
void http_server_serve(int conn) {
char buf[1024];
ssize_t buflen;
/* Read the data from the port, blocking if nothing yet there.
We assume the request (the part we care about) is in one packet */
buflen = recv(conn, buf, 1024, 0);
Genode::log("Request received!");
/* Ignore receive errors */
if (buflen > 0) {
/* Is this an HTTP GET command? (only check the first 5 chars, since
there are other formats for GET, and we're keeping it very simple)*/
if (buflen >= 5 &&
buf[0] == 'G' &&
buf[1] == 'E' &&
buf[2] == 'T' &&
buf[3] == ' ' &&
buf[4] == '/' ) {
/* Send http header */
send(conn, http_html_hdr, Genode::strlen(http_html_hdr), 0);
/* Send our HTML page */
send(conn, http_index_html, Genode::strlen(http_index_html), 0);
}
}
}
/**
* Server function, the server loops endless, waits for client requests
* and responds with a html page.
*/
int server() {
int s;
Genode::log("Create new socket ...");
if((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
Genode::error("no socket available!");
return -1;
}
Genode::log("Now, I will bind ...");
struct sockaddr_in in_addr;
in_addr.sin_family = AF_INET;
in_addr.sin_port = htons(80);
in_addr.sin_addr.s_addr = INADDR_ANY;
if(bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr))) {
Genode::error("bind failed!");
return -1;
}
Genode::log("Now, I will listen ...");
if(listen(s, 5)) {
Genode::error("listen failed!");
return -1;
}
/*
* Server loop
*
* Unblock client thread, wait for requests and handle them,
* after that close the connection.
*/
Genode::log("Start the loop ...");
while(true) {
struct sockaddr addr;
socklen_t len = sizeof(addr);
int client = accept(s, &addr, &len);
if(client < 0) {
Genode::warning("invalid socket from accept!");
continue;
}
http_server_serve(client);
close(client);
}
return 0;
}
int main()
{
Client client;
client.start();
server();
return 0;
}

View File

@ -1,5 +0,0 @@
TARGET = test-lwip_loop
LIBS = posix
SRC_CC = main.cc
CC_CXX_WARN_STRICT =