Querying thread-locking of a wave

I'm using a wave in a thread worker function and in the main thread. Yes I know I should not do that...
To prevent any bugs I would like to query the thread-locking state (not sure how to call it).

This is the property of a wave which gets complained about in the error message "error: Wave is in use by preemptive thread. Can't be resized or killed.".

Can be triggered with


threadsafe static Function WorkerFunc(data)
	WAVE data

	do
		DFREF dfr = ThreadGroupGetDFR(0, 0)

		if(DataFolderExistsDFR(dfr))
			break
		endif
		
	while(1)

	return 1
End

static Function StartMe()

	variable/G tgID
	WAVE data
	tgID = ThreadGroupCreate(1)
		
	ThreadStart tgID, 0, WorkerFunc(data)
	WAveclear data
End

Function Dostuff()

	Make/O/N=1000 data

	StartMe()
	NVAR tgID
	Make/O/N=(1001) data
End


Of course I could use a try and catch in various places, but that feels a bit like ringing the neighbours door bell to check if the national electricity grid is working.
That information is not accessible to you.

If you want to request it as a feature, please send a request to WaveMetrics support with an explanation of the how you would use it.

As a workaround, you could put something in the wave note before passing the wave to the thread or use some kind of naming convention indicating that the wave has been passed to a thread.