Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a function that i want it to be called every 20 seconds, i'm using a timer but it is not working, so i'm wondering is it because i'm calling it in a wrokng place !
below is my code, i want to know what i'm doing wrong ??!

static void Main()
{

System.Threading.Timer LaunchingTimer = new System.Threading.Timer(new TimerCallback(CreateThreads), null, 0, 20 * 1000);
}

static void CreateThreads()
{
Thread thread1 = new Thread(new ThreadStart(LaunchApp));
Thread thread2 = new Thread(new ThreadStart(LaunchApp));

thread1.Start();
thread2.Start();
}
Posted

1 solution

CreateThreads must match TimerCallback delegate:
static void CreateThreads(object state){...}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900