Home About

All posts tagged with "Thread"

In software, threads make it possible to run methods in parallel this makes it possible to execute programs faster by running more methods at the same time.

Page 1 of 1

C# - How to start multiple tasks and wait for them all to finish

What you are likely looking for is the method Task.WaitAll(task1, task2, task3..);. The method allows you to wait for several tasks to finish, even »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Task, Thread 20 December 2021

C# - When to use threads instead of tasks

I have not yet found a situation where I needed a thread instead of a Task. Threads are a lower level concept when compared to tasks. »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Task, Thread 31 October 2020

C# - How to easily create and start a new thread

It is quite easy to start a new thread in C#. All you need is to instantiate a new object of the type Thread and call »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Thread, Task 30 May 2020

What is the lock statement (monitor) in C#? and what you should look out for

In this post I will show how the lock statement in C# works and what you should look out for when using it. It is well »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Lock, Thread 25 April 2020

C# - What is the difference between threads and tasks?

I had a discussion a couple of weeks ago about tasks and threads. It occurred to me that I had rarely used threads and mostly used »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, .Net, Task, Thread 08 November 2018

C# - How to break an async/await chain when calling something that is not asynchronous

I have sometimes found myself - at the end of a long chain of using async/await - calling something that is not using async. Sometimes »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Task, Thread 16 October 2018

C# - Iterate through each item from a list in parallel and wait for them all to finish

It is quite easy to iterate through each item in a list and wait for the result. All you have to do is use Parallel.ForEach( »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Parallel, Thread 02 October 2018

Easy and Simple way to start a new task in C#

I recently look for an easy way to start a new task in C#. Many of the examples that I found required several lines of code. »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Thread 13 October 2017

C# - Thread.Sleep(1); takes more than 1 milisecond - around 16ms

I recently had to hunt down a bug. We were experiencing a piece of code running very slowly. The executed code should take way less than »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Thread, .Net 30 April 2017
Page 1 of 1
Rss
Twitter
LinkedIn
profile for Peter Rasmussen at Stack Overflow, Q&A for professional and enthusiast programmers
Peter Daugaard Rasmussen - developer, Consultant, Blogger © 2022 Cookie policy