My basic requirement is that the program needs to run in background and consume as less memory n CPU time as possible..I am not a expert in threading .. my guess was to create threads n execute them
to give an example :
Expand|Select|Wrap|Line Numbers
- public static Thread t2;
- public static Thread t11;
Expand|Select|Wrap|Line Numbers
- t2 = new Thread(new ThreadStart(this.functionname));
- t2.Priority = ThreadPriority.Lowest;//BelowNormal;
- t2.Start();
and a static bool variable
Expand|Select|Wrap|Line Numbers
- public static bool timerOn = true; // To see to it that "function" called completes before called again
- public void fun1(object source, ElapsedEventArgs e)
- {
- if (timerOn) //static variable to see to that only when one
- // thread comepltes the second thread starts.
- {
- Thread tt = new Thread(new ThreadStart(this.fun11));
- timerOn = false;
- //CreateFolders();
- //tt.Priority = ThreadPriority.BelowNormal.;// which is beetter
- tt.Start();
- }
- }
- public void fun11()
- {
- fun2();
- fun3();
- timeron=true;
- }
main thing is low cpu usage n low memory consumption...