|
Publicité ' | |||||||||||||||||||||||
|
|
#1 |
|
Membre éclairé
![]() Étudiant Inscription : novembre 2007 Messages : 626 ![]() |
Bonjour,
j'utilise une dll qui sert de wrapper d'interface COM. Il y a des méthodes de lecture / écriture asynchrone (event lancé lorsque les opérations sont terminées) et j'ai besoin de rendre ces méthodes synchrones. Je voulais utilisé un ManualResetEvent mais les events sont appelés dans le thread courant (du coup il faut sortir de la méthode en cours pour que l'event soit appelé...) Comment faire pour dispatcher l'event vers un thread différent ? Merci d'avance. |
|
|
00
|
|
|
#2 |
|
Expert Confirmé
![]() ![]() |
Si tu les appelle dans une Task, et que tu attend la fin de celle-ci?
Ou alors dans un backgroundworker?
__________________
Microsoft MVP : Visual C# MCPD - Windows Phone Developer MCPD - Windows Developer 4 http://www.guruumeditation.net “If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger W. Dijkstra) |
|
00
|
|
|
#3 |
|
Membre éclairé
![]() Étudiant Inscription : novembre 2007 Messages : 626 ![]() |
Salut,
Backgrouner : ça ne fonctionne pas. Task : pas essayé. Je viens de trouver ce site : http://geekswithblogs.net/rgray/arch...nous-call.aspx Il dit entre autre : ---- The asynchronous (event) call has now been turned into synchronous. The biggest problem is the showstopper though. COM doesn’t play well using this model, thanks to it’s STA threading (I believe) and the event handler never gets called. Overall a great learning experience, but I still can’t call the COM wrapper object synchronously and now, admitting defeat, I am rolling my own class to calculate the StreetId. ---- |
|
|
00
|
Copyright © 2000-2013 - www.developpez.com