[En-Nut-Discussion] How to get some comfort with threads?

Adam Dybkowski adybkows at wp.pl
Wed Sep 2 22:38:30 CEST 2009


Ulrich Prinz wrote:

> I'd like to give some debug while system starts up. With dvice drivers 
> it is easy as the dev->dev_name gives an easy access to the devices name.
> 
> But with threads I don't know how to get the name of a thread.

If you've got thread handle:

HANDLE th;

then it's easy to get the name of that thread:

const char *name = ((NUTTHREADINFO *) th)->td_name;

See for example the source code of system function NutThreadWake(),
everything will be clear. Also see NutDumpThreadList().

To do opposite conversion (map name to thread handle), just call
GetThreadByName().

-- 
Adam Dybkowski
		adybkows at wp.pl
		http://dybkowski.net/



More information about the En-Nut-Discussion mailing list