Thread: Process Plugin
View Single Post
Old 2008-05-30, 13:56   #5 (permalink)
framug
Portal Member
 
framug's Avatar
 
Join Date: Apr 2006
Location: France
Posts: 170
Thanks: 0
Thanked 3 Times in 3 Posts

Country:

My System

Default

Sorry, I didn't read this part of wiki.

I could put code here but, I would be too long.
Better is to look in MP code, in some process plugins, to see how it works or, taking a look in some MP plugins which already use it.
here :
SourceForge.net Repository - [mp-plugins] Index of /trunk/plugins

Edit : it's a good day, today.
Here is a sample code :

Code:
using System.Threading;

        bool _run;
        Thread _thread;

        public void Start()
        {
            _run = true;
            _thread = new Thread(new ThreadStart(Run));
            _thread.IsBackground = true;
            _thread.Name = "plugin thread";
            _thread.Priority = ThreadPriority.Lowest;
            _thread.Start();
        }

        public void Stop()
        {
            _run = false;
        }

        private void Run()
        {
            while (_run)
            {
                // your treatment
            }
        }

Last edited by framug; 2008-05-30 at 14:37. Reason: add source code
framug is offline   Reply With Quote