wpf - Issues with Galasoft Messenger class in multi threaded environment -
i have 2 classes lets classa , classb. have communicate of galasoft messenger class. in classa, have following code :-
class :
messenger.default.register<notifyinterface>(this, performaction); private void performaction(notifyinterface objnotify) { switch(objnotify.someproperty) { case "a": // break; case "b": // else break; } }
from classb want send parallel notifications of messenger i.e. want execute 'case a' , 'case b' parallely. doing this.
classb:
system.threading.threadpool.queueuserworkitem((object context) => { messenger.default.send<notifyinterface>(objnotifycasea); }, null); messenger.default.send<notifyinterface>(objnotifycaseb);
but second notification not received until first 1 gets over. limitation of messenger class 2 notifications cannot sent in parallel?
well, not sure whether bug or by-design, yes - messenger locks while sending messages (for instance, if you'll try send message within message's handler you'll dead-lock).
the issue discussed @ mvvm light toolkit project site , solution proposed this pull request, afaik not yet confirmed , merged trunk.
as temporary workaround until new version of toolkit released can sources , apply changes mentioned above - solve issue.
Comments
Post a Comment