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
JUKE BOX
NA
28
7.5k
ERROR- inavalid token BOOL in class
Dec 13 2014 3:17 AM
i wrote a program of thread as below and it is showing error as INAVALID TOKEN BOOL IN CLASS,INTERFACE OR METHOD
using System;
using System.Threading;
namespace ConsoleApplication1
{
public class worker
{
public void dowork()
{
while (!_shouldstop)
{
Console.WriteLine("doworker thread is proessing ");
}
Console.WriteLine("doworker thread is terminating ");
}
public void requeststop()
{
_shouldstop=true;
}
private Volatile bool _shouldstop;
}
public class workerthreadex
{
static void Main()
{
worker ws = new worker();
Thread th = new Thread(ws.dowork);
th.Start();
Console.WriteLine("main function starting do work thread");
while(th.IsAlive)
{
Thread.Sleep(1);
}
ws.requeststop();
th.Join();
Console.WriteLine("thread terminated successfully");
Console.ReadKey();
}
}
}
Reply
Answers (
2
)
Property Modifier
convert string