c# - Can I "block" a function until an asynch thread has finished? -
i have code on winform:
private void buttonstart_click(object sender, eventargs e) { task.factory.startnew(() => threadfunction()) .continuewith(t => threadfunctioncomplete() , cancellationtoken.none , taskcontinuationoptions.none , taskscheduler.fromcurrentsynchronizationcontext()); threadfinished(); }
and i'd start threadfinished()
when threadfunctioncomplete()
has been finished. well, put threadfinished()
@ end of threadfunctioncomplete()
, workflow of process won't. possible? sort of wait/lock maybe?
basically, can call continuewith
twice:
task.factory.startnew(....) .continuewith(...) .continuewith(...)
Comments
Post a Comment