system.tag.writeAsync callback Useless?

system.tag.writeAsync | Ignition User Manual

system.tag.writeBlocking

returnList2 = system.tag.writeBlocking(['[default]testTag111','[default]testTag22266'],[12,22])
print returnList2
prop = returnList2[0].isGood()
for i in range(len(returnList2)):
	prop=returnList2[i].isGood()
	if(prop==False):
		print 'False'
	else:
		print 'True'

image

Right! Because the second tagPath is not fund.

system.tag.writeAsync

def myCallback(asyncReturn):
	for result in asyncReturn:
		if not result.good:
			print 'False'
system.tag.writeAsync(['[default]testTag111','[default]testTag22266'],[12,22],myCallback)

I think it should print Flase. Why it print nothing?

Because it's printing on another thread.

4 Likes

That's what the callback is for. The whole point of "async" is that the operation occurs separately while the main thread continues with other things. There is nothing to return to the main thread. The callback is later handed the "return" value as its argument.

In the designer script console, only prints from the main thread reach the console.

1 Like

4 Likes