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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -