1 Replies - 2107 Views - Last Post: 29 July 2012 - 07:04 AM Rate Topic: -----

#1 Loopzle  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 35
  • Joined: 23-October 10

Non-GUI Cross-Thread Invoke?

Posted 29 July 2012 - 01:53 AM


I am writing a client library for people to use, which will be open source. This will obviously not always necessarily be as a GUI application, as the person may choose to use command line instead, and I do not want to restrict people to using GUI, obviously.

I am trying to do a cross-thread invoke, preferably with parameters, so that I can invoke methods on the main thread from the socket read thread. I have tried using a dispatcher, however, it was very temperamental and I would prefer a method that does not require using an assembly reference when compiling as this may confuse those using the library.

I've tried looking in a lot of places, but am unable to find any other solutions, so I decided to ask here for suggestions for how I should do it.


Is This A Good Question/Topic? 0
  • +

Replies To: Non-GUI Cross-Thread Invoke?

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1009
  • View blog
  • Posts: 3,564
  • Joined: 05-June 09

Re: Non-GUI Cross-Thread Invoke?

Posted 29 July 2012 - 07:04 AM

I'm not sure of the purpose of your library, but would providing an event on your class that clients can register to for when something needs to happen resolve this?

That's probably better than having something arbitrarily using the third party's main thread for your execution anyway, I know that I wouldn't expect this to happen if I'd fired a method which I assume is async? I mean, I wouldn't want it to return control to the main thread automatically, I would want some way to be informed that you would like to execute something there based on something that just happened.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1