Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
ERROR- inavalid token BOOL in class
JUKE BOX
Dec 13 2014 3:17 AM
671
Reply
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();
}
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Property Modifier
convert string