Returns the handle to the running Thread

Property definitions

pthreads :: pthreads $ Sys :: thread
# Returns the handle to the running `Thread`
fun thread: Thread
do
	var key = sys.self_thread_key
	var val = key.get
	if val == null then
		# This is the original thread, get `Sys::main_thread` and store it
		var thread = sys.main_thread
		key.set thread
		return thread
	end

	assert val isa Thread
	return val
end
lib/pthreads/pthreads.nit:369,1--383,3