c# - How do I do the equivalent of TaskCompletionSource<nothing>? -


i want have eventwaithandle-like task await on on 1 end, , set completed on other end. taskcompletionsource want, requires me pass value. use dummy value, before thought i'd see if there's more correct solution.

the point able use task.waitany.

the common scenario i've seen in source code create empty struct equivalent nothing. or use bool dummy:

internal struct void { } 

and then:

var tcs = new taskcompletionsource<void>(); 

i've seen common pattern in bcl source code well:

// special internal struct use signify not interested in // task<voidtaskresult>'s result. internal struct voidtaskresult { } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -