base: do not allow unnamed threads

fix #901
This commit is contained in:
Martin Stein 2013-10-10 17:00:03 +02:00 committed by Christian Helmuth
parent afdabe9df8
commit ee5d213c1f
41 changed files with 68 additions and 30 deletions

View File

@ -48,7 +48,7 @@ class Genode::Interrupt_handler : public Thread<4096>
{ {
private: private:
Interrupt_handler() { start(); } Interrupt_handler() : Thread("irq_handler") { start(); }
public: public:

View File

@ -19,7 +19,8 @@ struct Thread : Genode::Thread<STACK_SIZE>
{ {
Genode::Lock &_barrier; Genode::Lock &_barrier;
Thread(Genode::Lock &barrier) : _barrier(barrier) { start(); } Thread(Genode::Lock &barrier)
: Genode::Thread<STACK_SIZE>("stat"), _barrier(barrier) { start(); }
void entry() void entry()
{ {

View File

@ -403,7 +403,7 @@ namespace Genode {
* *
* \param name thread name (for debugging) * \param name thread name (for debugging)
*/ */
explicit Thread(const char *name = "<noname>") explicit Thread(const char *name)
: Thread_base(name, STACK_SIZE) { } : Thread_base(name, STACK_SIZE) { }
}; };
} }

View File

@ -76,7 +76,7 @@ int main(int argc, char **argv)
/* construct the thread objects */ /* construct the thread objects */
for (unsigned i = 0; i < cpus.total(); i++) for (unsigned i = 0; i < cpus.total(); i++)
threads[i] = new (env()->heap()) threads[i] = new (env()->heap())
Spinning_thread(cpus.location_of_index(i), "thread"); Spinning_thread(cpus.location_of_index(i), "spinning_thread");
/* wait until all threads are up and running */ /* wait until all threads are up and running */
for (unsigned i = 0; i < cpus.total(); i++) for (unsigned i = 0; i < cpus.total(); i++)

View File

@ -156,7 +156,7 @@ struct Destruct_thread : Genode::Thread<4096>
PLOG("thread: destruction completed, job done"); PLOG("thread: destruction completed, job done");
} }
Destruct_thread(Object *obj) : obj(obj) { } Destruct_thread(Object *obj) : Thread("object_destructor"), obj(obj) { }
}; };

View File

@ -50,6 +50,7 @@ class Local_fault_handler : public Thread<4096>
Local_fault_handler(Rm_session *rm_session, Signal_receiver *receiver) Local_fault_handler(Rm_session *rm_session, Signal_receiver *receiver)
: :
Thread("local_fault_handler"),
_rm_session(rm_session), _receiver(receiver) _rm_session(rm_session), _receiver(receiver)
{ } { }

View File

@ -52,7 +52,9 @@ namespace Nic {
void inc(size_t s) { cnt++; size += s; } void inc(size_t s) { cnt++; size += s; }
void inc_burst() { burst++; } void inc_burst() { burst++; }
Counter(char const *prefix) : prefix(prefix), cnt(0), burst(0), size(0) { start(); } Counter(char const *prefix)
: Thread("counter"), prefix(prefix), cnt(0), burst(0), size(0)
{ start(); }
}; };
#else #else
struct Counter struct Counter

View File

@ -180,7 +180,7 @@ class Timer_thread : public Thread<4096>
* *
* Start thread immediately on construction. * Start thread immediately on construction.
*/ */
Timer_thread() { start(); } Timer_thread() : Thread("timer") { start(); }
void entry() void entry()
{ {

View File

@ -248,6 +248,7 @@ class Child_destructor_thread : Thread<2*4096>
* Constructor * Constructor
*/ */
Child_destructor_thread() : Child_destructor_thread() :
Thread("child_destructor"),
_curr_child(0), _curr_alloc(0), _curr_child(0), _curr_alloc(0),
_activate_lock(Lock::LOCKED), _activate_lock(Lock::LOCKED),
_ready(true) _ready(true)

View File

@ -43,7 +43,7 @@ namespace Lwip {
public: public:
Scheduler() : _curr_time(0) { } Scheduler() : Thread("lwip_timeout_sched"), _curr_time(0) { }
Genode::Alarm::Time curr_time() { return _curr_time; } Genode::Alarm::Time curr_time() { return _curr_time; }
}; };

View File

@ -43,6 +43,8 @@ class Client : public Genode::Thread<4096>
{ {
public: public:
Client() : Thread("client") { }
void entry() void entry()
{ {
/* client loop */ /* client loop */

View File

@ -44,7 +44,7 @@ namespace Block {
public: public:
Tx_thread(Session_component *session) Tx_thread(Session_component *session)
: _session(session) { } : Thread("block_session_tx"), _session(session) { }
void entry() void entry()
{ {

View File

@ -74,7 +74,8 @@ class Input::Tablet_driver : Genode::Thread<8192>
} }
Tablet_driver(Event_queue &ev_queue) Tablet_driver(Event_queue &ev_queue)
: _ev_queue(ev_queue), : Thread("touchscreen_signal_handler"),
_ev_queue(ev_queue),
_gpio_ts(GPIO_TOUCH), _gpio_ts(GPIO_TOUCH),
_gpio_bt(GPIO_BUTTON), _gpio_bt(GPIO_BUTTON),
_ts_sig_cap(_init_ts_gpio()), _ts_sig_cap(_init_ts_gpio()),

View File

@ -30,6 +30,7 @@ class Irq_handler : Genode::Thread<4096>
Irq_handler(int irq_number, Input_driver &input_driver) Irq_handler(int irq_number, Input_driver &input_driver)
: :
Thread("irq_handler"),
_irq(irq_number), _irq(irq_number),
_input_driver(input_driver) _input_driver(input_driver)
{ {

View File

@ -34,6 +34,7 @@ class Irq_handler : Genode::Thread<4096>
Irq_handler(int irq_number, Serial_interface *channel, Input_driver &input_driver) Irq_handler(int irq_number, Serial_interface *channel, Input_driver &input_driver)
: :
Thread("irq_handler"),
_irq(irq_number), _irq(irq_number),
_channel(channel), _channel(channel),
_input_driver(input_driver) _input_driver(input_driver)

View File

@ -172,6 +172,7 @@ namespace Timer {
*/ */
Timeout_scheduler(Platform_timer *pt, Genode::Rpc_entrypoint *ep) Timeout_scheduler(Platform_timer *pt, Genode::Rpc_entrypoint *ep)
: :
Thread("timeout_scheduler"),
_platform_timer(pt), _platform_timer(pt),
_irq_dispatcher_component(this, pt), _irq_dispatcher_component(this, pt),
_irq_dispatcher_cap(ep->manage(&_irq_dispatcher_component)) _irq_dispatcher_cap(ep->manage(&_irq_dispatcher_component))

View File

@ -49,8 +49,11 @@ class Kdb_uart : public Uart::Driver
Char_avail_checker_thread(Uart::Driver &uart_driver, Char_avail_checker_thread(Uart::Driver &uart_driver,
Uart::Char_avail_callback &char_avail_callback) Uart::Char_avail_callback &char_avail_callback)
: _uart_driver(uart_driver), :
_char_avail_callback(char_avail_callback) { } Thread<STACK_SIZE>("char_avail_handler"),
_uart_driver(uart_driver),
_char_avail_callback(char_avail_callback)
{ }
void entry() void entry()
{ {
@ -72,7 +75,8 @@ class Kdb_uart : public Uart::Driver
* Constructor * Constructor
*/ */
Kdb_uart(Uart::Char_avail_callback &callback) Kdb_uart(Uart::Char_avail_callback &callback)
: _buffered_char(-1), :
_buffered_char(-1),
_char_avail_checker_thread(*this, callback) _char_avail_checker_thread(*this, callback)
{ {
_char_avail_checker_thread.start(); _char_avail_checker_thread.start();

View File

@ -217,6 +217,8 @@ namespace Iso {
public: public:
Pager() : Thread("iso_pager") { }
Signal_receiver *signal_receiver() { return &_receiver; } Signal_receiver *signal_receiver() { return &_receiver; }
void entry() void entry()

View File

@ -116,7 +116,7 @@ class Audio_out::Mixer : public Thread<1024 * sizeof(addr_t)>
Mixer() Mixer()
: :
Thread("mixer"), Thread("audio_out_mixer"),
_sleep_lock(Lock::LOCKED), _left("left", false, true), _sleep_lock(Lock::LOCKED), _left("left", false, true),
_right("right", false, true) _right("right", false, true)
{ {

View File

@ -128,6 +128,7 @@ namespace Nic {
: :
Genode::Allocator_avl(rx_block_md_alloc), Genode::Allocator_avl(rx_block_md_alloc),
Tx_rx_communication_buffers(tx_buf_size, rx_buf_size), Tx_rx_communication_buffers(tx_buf_size, rx_buf_size),
Thread("nic_packet_handler"),
Session_rpc_object(Tx_rx_communication_buffers::tx_ds(), Session_rpc_object(Tx_rx_communication_buffers::tx_ds(),
Tx_rx_communication_buffers::rx_ds(), Tx_rx_communication_buffers::rx_ds(),
static_cast<Genode::Range_allocator *>(this), ep) static_cast<Genode::Range_allocator *>(this), ep)

View File

@ -59,7 +59,7 @@ namespace Block {
public: public:
Tx_thread(Session_component *session) Tx_thread(Session_component *session)
: _session(session) { } : Thread("block_session_tx"), _session(session) { }
void entry() void entry()
{ {

View File

@ -51,7 +51,8 @@ namespace Block {
addr_t dev_addr, addr_t dev_addr,
size_t dev_size, size_t dev_size,
size_t blk_size) size_t blk_size)
: _session(session), : Thread("block_session_tx"),
_session(session),
_dev_addr(dev_addr), _dev_addr(dev_addr),
_dev_size(dev_size), _dev_size(dev_size),
_blk_size(blk_size) { } _blk_size(blk_size) { }

View File

@ -331,7 +331,8 @@ namespace Genode {
Vmm(addr_t tsc_base, addr_t tpc_base, Vmm(addr_t tsc_base, addr_t tpc_base,
addr_t sys_base, addr_t sp810_base, addr_t sys_base, addr_t sp810_base,
Vm *vm) Vm *vm)
: _tsc_io_mem(tsc_base, 0x1000), : Thread("vmm_signal_handler"),
_tsc_io_mem(tsc_base, 0x1000),
_tpc_io_mem(tpc_base, 0x1000), _tpc_io_mem(tpc_base, 0x1000),
_sys_io_mem(sys_base, 0x1000), _sys_io_mem(sys_base, 0x1000),
_sp810_io_mem(sp810_base, 0x1000), _sp810_io_mem(sp810_base, 0x1000),

View File

@ -46,7 +46,7 @@ class Alarm_thread : Thread<4096>, public Alarm_scheduler
/** /**
* Constructor * Constructor
*/ */
Alarm_thread(): _curr_time(0) { start(); } Alarm_thread(): Thread("alarm"), _curr_time(0) { start(); }
Alarm::Time curr_time() { return _curr_time; } Alarm::Time curr_time() { return _curr_time; }
}; };

View File

@ -37,7 +37,7 @@ class Worker : public Genode::Thread<8192>
* Constructor * Constructor
*/ */
Worker(Genode::Allocator_avl *block_alloc) Worker(Genode::Allocator_avl *block_alloc)
: _blk_con(block_alloc) { } : Thread("worker"), _blk_con(block_alloc) { }
void dump(Block::Packet_descriptor &p1, Block::Packet_descriptor &p2) void dump(Block::Packet_descriptor &p1, Block::Packet_descriptor &p2)
{ {

View File

@ -50,7 +50,8 @@ namespace Block {
/** /**
* Constructor * Constructor
*/ */
Tx_thread(Session_component *session) : _session(session) { } Tx_thread(Session_component *session)
: Thread("block_session_tx"), _session(session) { }
/** /**
* Thread entry function. * Thread entry function.

View File

@ -48,6 +48,8 @@ class Pager : public Thread<8192>
public: public:
Pager() : Thread("pager") { }
Signal_receiver *signal_receiver() { return &_receiver; } Signal_receiver *signal_receiver() { return &_receiver; }
void entry() void entry()

View File

@ -140,6 +140,7 @@ class Source : private Genode::Thread<STACK_SIZE>,
Source(Genode::Dataspace_capability ds_cap) Source(Genode::Dataspace_capability ds_cap)
: :
/* init bulk buffer allocator, storing its meta data on the heap */ /* init bulk buffer allocator, storing its meta data on the heap */
Thread("source"),
Genode::Allocator_avl(Genode::env()->heap()), Genode::Allocator_avl(Genode::env()->heap()),
Packet_stream_source<Test_packet_stream_policy>(this, ds_cap), Packet_stream_source<Test_packet_stream_policy>(this, ds_cap),
_operation(OP_NONE), _operation(OP_NONE),
@ -220,6 +221,7 @@ class Sink : private Genode::Thread<STACK_SIZE>,
*/ */
Sink(Genode::Dataspace_capability ds_cap) Sink(Genode::Dataspace_capability ds_cap)
: :
Thread("sink"),
Packet_stream_sink<Test_packet_stream_policy>(ds_cap), Packet_stream_sink<Test_packet_stream_policy>(ds_cap),
_operation(OP_NONE), _operation(OP_NONE),
_lock(Genode::Lock::LOCKED), _lock(Genode::Lock::LOCKED),

View File

@ -39,7 +39,7 @@ class Comparer : public Genode::Thread<8192>
Comparer(Genode::Allocator_avl *block_alloc, Comparer(Genode::Allocator_avl *block_alloc,
const char* filename) const char* filename)
: _blk_con(block_alloc), _rom(filename), : Thread("comparer"), _blk_con(block_alloc), _rom(filename),
_addr(Genode::env()->rm_session()->attach(_rom.dataspace())) { } _addr(Genode::env()->rm_session()->attach(_rom.dataspace())) { }
void entry() void entry()

View File

@ -71,6 +71,7 @@ class Sender : Thread<4096>
Sender(Signal_context_capability context, Sender(Signal_context_capability context,
unsigned interval_ms, bool verbose = true) unsigned interval_ms, bool verbose = true)
: :
Thread("sender"),
_transmitter(context), _transmitter(context),
_interval_ms(interval_ms), _interval_ms(interval_ms),
_stop(false), _stop(false),
@ -161,6 +162,7 @@ class Handler : Thread<4096>
*/ */
Handler(Signal_receiver *receiver, unsigned dispatch_ms, bool verbose = true) Handler(Signal_receiver *receiver, unsigned dispatch_ms, bool verbose = true)
: :
Thread("handler"),
_dispatch_ms(dispatch_ms), _dispatch_ms(dispatch_ms),
_id(++_id_cnt), _id(++_id_cnt),
_receiver(receiver), _receiver(receiver),
@ -541,7 +543,8 @@ class Signal_context_destroyer : public Thread<4096>
public: public:
Signal_context_destroyer(Signal_receiver *receiver, Signal_context *context) Signal_context_destroyer(Signal_receiver *receiver, Signal_context *context)
: _receiver(receiver), _context(context) { } : Thread("signal_context_destroyer"),
_receiver(receiver), _context(context) { }
void entry() void entry()
{ {

View File

@ -36,6 +36,7 @@ struct Worker : Genode::Thread<4096>
Worker(Timer::Session &timer, int result_value) Worker(Timer::Session &timer, int result_value)
: :
Thread("worker"),
timer(timer), result_value(result_value), result(~0) timer(timer), result_value(result_value), result(~0)
{ {
start(); start();

View File

@ -32,7 +32,8 @@ class Wakeup_thread : public Thread<4096>
Wakeup_thread(Timed_semaphore *sem, Wakeup_thread(Timed_semaphore *sem,
Timer::Session *timer, Timer::Session *timer,
Alarm::Time timeout) Alarm::Time timeout)
: _sem(sem), _timer(timer), _timeout(timeout), _lock(Lock::LOCKED), _stop(false) { } : Thread("wakeup"), _sem(sem), _timer(timer), _timeout(timeout),
_lock(Lock::LOCKED), _stop(false) { }
void entry() void entry()
{ {

View File

@ -47,7 +47,8 @@ class Timer_client : public Genode::List<Timer_client>::Element,
* Constructor * Constructor
*/ */
Timer_client(unsigned long period_msec) Timer_client(unsigned long period_msec)
: _period_msec(period_msec), _cnt(0), _stop(false) { } : Thread("timer_client"),
_period_msec(period_msec), _cnt(0), _stop(false) { }
/** /**
* Start calling the timer service * Start calling the timer service

View File

@ -59,7 +59,7 @@ struct Counter : public Genode::Thread<8192>
void inc(Genode::size_t s) { cnt++; size += s; } void inc(Genode::size_t s) { cnt++; size += s; }
Counter() : cnt(0), size(0) { start(); } Counter() : Thread("net-counter"), cnt(0), size(0) { start(); }
}; };
#else #else
struct Counter { inline void inc(Genode::size_t s) { } }; struct Counter { inline void inc(Genode::size_t s) { } };

View File

@ -191,7 +191,7 @@ if {![regexp {\* 2 Thread 2 Test_thread::entry} $gdb_output] ||
exit -1 exit -1
} }
if {![regexp {40 func()} $gdb_output]} { if {![regexp {42 func()} $gdb_output]} {
puts stderr "Error: Single stepping didn't result in the expected output" puts stderr "Error: Single stepping didn't result in the expected output"
exit -1 exit -1
} }

View File

@ -72,7 +72,8 @@ namespace Noux {
} }
public: public:
Timeout_scheduler(unsigned long curr_time) : _curr_time(curr_time) { start(); } Timeout_scheduler(unsigned long curr_time)
: Thread("timeout_sched"), _curr_time(curr_time) { start(); }
Alarm::Time curr_time() const { return _curr_time; } Alarm::Time curr_time() const { return _curr_time; }
}; };

View File

@ -23,6 +23,8 @@ class Test_thread : public Genode::Thread<2*4096>
{ {
public: public:
Test_thread() : Thread("test") { }
void func() void func()
{ {
/* /*

View File

@ -347,6 +347,7 @@ Vancouver_console::Vancouver_console(Synced_motherboard &mb,
Genode::size_t vm_fb_size, Genode::size_t vm_fb_size,
Genode::Dataspace_capability fb_ds) Genode::Dataspace_capability fb_ds)
: :
Thread("vmm_console"),
_startup_lock(Genode::Lock::LOCKED), _startup_lock(Genode::Lock::LOCKED),
_vm_fb_size(vm_fb_size), _motherboard(mb), _console_lock(console_lock), _vm_fb_size(vm_fb_size), _motherboard(mb), _console_lock(console_lock),
_fb_size(0), _pixels(0), _guest_fb(0), _fb_size(0), _pixels(0), _guest_fb(0),

View File

@ -54,6 +54,7 @@ Vancouver_disk::Vancouver_disk(Synced_motherboard &mb,
char * backing_store_base, char * backing_store_base,
char * backing_store_fb_base) char * backing_store_fb_base)
: :
Thread("vmm_disk"),
_motherboard(mb), _backing_store_base(backing_store_base), _motherboard(mb), _backing_store_base(backing_store_base),
_backing_store_fb_base(backing_store_fb_base), _backing_store_fb_base(backing_store_fb_base),
_tslab_msg(disk_heap()), _tslab_dma(disk_heap()), _tslab_avl(disk_heap()) _tslab_msg(disk_heap()), _tslab_dma(disk_heap()), _tslab_avl(disk_heap())

View File

@ -132,7 +132,8 @@ class Alarm_thread : Thread<4096>, public Alarm_scheduler
* Constructor * Constructor
*/ */
Alarm_thread(Synced_motherboard &mb, Synced_timeout_list &timeouts) Alarm_thread(Synced_motherboard &mb, Synced_timeout_list &timeouts)
: _curr_time(0), _motherboard(mb), _timeouts(timeouts) { start(); } : Thread("alarm"), _curr_time(0), _motherboard(mb), _timeouts(timeouts)
{ start(); }
Alarm::Time curr_time() { return _curr_time; } Alarm::Time curr_time() { return _curr_time; }
unsigned long long curr_time_long() { return _motherboard()->clock()->time(); } unsigned long long curr_time_long() { return _motherboard()->clock()->time(); }
@ -799,6 +800,7 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
bool has_svm, bool has_svm,
bool has_vmx) bool has_vmx)
: :
Thread("vcpu_dispatcher"),
_vcpu(vcpu_lock, unsynchronized_vcpu), _vcpu(vcpu_lock, unsynchronized_vcpu),
_vcpu_thread("vCPU thread"), _vcpu_thread("vCPU thread"),
_guest_memory(guest_memory), _guest_memory(guest_memory),

View File

@ -25,7 +25,7 @@ extern const void * _forward_pkt;
Vancouver_network::Vancouver_network(Synced_motherboard &mb, Nic::Session *nic) Vancouver_network::Vancouver_network(Synced_motherboard &mb, Nic::Session *nic)
: _motherboard(mb), _nic(nic) : Thread("vmm_network"), _motherboard(mb), _nic(nic)
{ {
start(); start();
} }