TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Arun Kurmi
NA
104
103.8k
Thread Suspending
Jul 7 2013 9:49 AM
this is Error in my code---
Thread_Suspend.cs(12,1): warning CS0618: 'System.Threading.Thread.Suspend()' is obsolete: 'Thread.Suspend has been deprecated. Please use other classes in
System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.
http://go.microsoft.com/fwlink/?linkid=14202'
And my code are:
using System;
using System.Threading;
namespace my{
class program{
static Thread th;
static void Main(){
th=new Thread(MyFunction);
th.Name="My Thread";
Console.WriteLine("Threading start......");
th.Start();
Thread.Sleep(10000);
th.Suspend();
Console.WriteLine("Now Thread Suspended.");
}
static void MyFunction(){
int i;
for(i=1;i<25;i++)
{
int time=new Random().Next(25,50);
Console.WriteLine("Thread {0} display and then thread suspend for {1} milliseconds",th.Name,time.ToString());
Thread.Sleep(time);
}
}
}
}
Reply
Answers (
6
)
C# Multiple Clients Chat Application................. :)
how to get API data in windows form application?