How to execute a block of code with 1 second intervals?

I need to execute a block every 1 second, but it needs to be in the same thread. This means, from what I understand, that I can't make the use of a timer class.

Is there a way to do what I want?

Answers


Create a thread and write a loop like so -

while(true)
{
    // do something
    Thread.sleep(1000);
}

Need Your Help

Tools for decoding SQL injection attempts, locating vulnerabilities

sql security sql-injection

I would like to decode their hex requests, what tools would I need?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.