INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Multi-threaded plug-in?  (Read 1682 times)

skeeterfood

  • Citizen of the Universe
  • *****
  • Posts: 779
  • We're all just food for the skeeters.
Multi-threaded plug-in?
« on: September 25, 2009, 10:57:12 pm »

Hi guys,

Is it possible to run multiple threads within a plug-in?  If so, anyone got any example code?  I want to run a serial receiver on a separate thread to receive events from my whole-house audio system.  Hooking to MC's events and sending serial commands to the controller seems simple enough, but I'm pretty inexperienced when it comes to threading in C#.

-John
Logged

muchadhesion

  • Recent member
  • *
  • Posts: 44
Re: Multi-threaded plug-in?
« Reply #1 on: September 26, 2009, 11:19:36 pm »

Yes, it is possible to run multiple threads in a plug-in.

I run a HTTP server thread, and a heavily threaded UPnP client stack inside a MC Interface plug-in.  All the usual C# threading techniques work fine.

Something to watch out for:  Many of the MC SDK APIs assume that they are to be executed in the main Windows Control thread, so you'll need to call them via Control.Invoke

Logged
Pages: [1]   Go Up