I can create a new Thread object and get a unique id string for it, but how can I get the currently running thread or its unique id string? Or equally useful for my purposes, how can I test if the currently running thread == a particular Thread that I've created?
I'm asking because I believe I can implement a particular function in a thread-safe way without locks, but only if I can evaluate what thread is calling the function.
There is an
OS.set_thread_name(), but no
get_thread_name(). I guess this is the string that I would get if I used
Thread.get_id(), but haven't tested this. In any case, I don't want to change any thread names, just look at them from running code.