multithreading - MailboxProcessor and interaction with GUI Thread -
i've created agent interacting gui means of synchronizationcontext:
type asyncworker(id:int) = let someevent = new event<int * string>() let errorevent = new event<_>() let synccontext = synchronizationcontext.current let f (inbox: mailboxprocessor<_>) = let rec loop () = async { let! message = inbox.receive () ... synccontext.raiseevent someevent (id, str) }
is there danger in that? if had 20 agents? these raised events synchronized? suppose have long time calculating function event. can sure other agents' event handlers waiting termination?
Comments
Post a Comment