You can geta list of all running threads:
List Of All Running Threads I am not sure how you can figure the threads created by a particular code block. I was thinking about stack trace but stack trace is per
thread and not across threads. So, it's not possible to know where it was spawned.
If your threads are named (or you could induce code to name them at the point they are created), you could probably iterate through the list of threads to check. But I am not sure you want to/can do that.
If you explain why you need to do this, we may be able to offer an alternative.