Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 120887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:52:57+00:00 2026-05-11T03:52:57+00:00

I am trying to use the .NET Backgroundworker Object in an application I am

  • 0

I am trying to use the .NET Backgroundworker Object in an application I am developing.

All the material on the internet say that this object runs in the ‘background’ but nowhere have I been able to confirm that this background thread indeed runs in a ‘low priority’ mode. This question arises because in Windows (I assume) a background task can run in a ‘normal’ or ‘below normal’ or ‘low’ priority mode.

In my application, I tried to set the priority myself inside the DoWork function by calling …

Thread.CurrentThread.Priority=ThreadPriority.Lowest 

…

but this seems to have no effect. Does the backgroundworker ignore this call?

I would like to explain some more:

My application is an internet client that collects real-time data on temperature,humidity etc from a chamber and uploads to a web page (not a web service) using

system.net.webclient.UploadValuesAsync(...) calls

I have written the application such that the client GUI collects the data from the chamber, time-stamps them and then queues them for upload like so

…

Synclock objlock     debug.print('Queueing reading...')     dataQ.Enque(reading) End Synclock ... 

The backgroundworker’s Dowork function dequeues and then uploads like so…

…………..

Do         if dataQ.count() <> 0 then             Synclock objlock               reading = dataQ.DeQue()             End Synclock             Dim client As New System.Net.WebClient             ...put the reading in NameValueCollection and upload to server page             req = new NameValueCollection             ...             ...             client.UploadValuesAsync(uri, 'POST', req)         endif         thread.sleep(1) 'without this line the CPU usage goes upto 100% and seems to slow other tasks!     Loop 

…………….

When I run the program I find that whenever the UploadValuesAsync is called the print out the debug window stops. I had also added debug statements to see how many readings are in the queue at any time. It this task is truly run in a low priority, I expected to see the queue count increase rapidly as data is acquired and then decrease only when foreground is idle and data is not being acquired. But this is not the case. As soon as a reading is added to the queue it is dequeued and uploaded. So the queue count is always is either 1 or 0!

Is there something wrong in my approach? Should I not be using the background-worker object at all?

BTW, this is in a dual-core laptop running Windows XP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:52:58+00:00Added an answer on May 11, 2026 at 3:52 am

    Just to add to what Jon and Marc have already said:

    Background threads do not have lower priority. The difference between foreground and background threads is that the CLR will shutdown the process once no more foreground threads are running. Thread pool threads are background threads.

    You can actually set the priority of a thread pool thread, but as you have next to no control of which thread pool thread will actually run your task it is not advisable to do so. If you need threads of a specific priority you should create them using the Thread type and set the priority on the instance as desired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 176k
  • Answers 176k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It isn't clear to me where your code is to… May 12, 2026 at 3:14 pm
  • Editorial Team
    Editorial Team added an answer I think they only run in sandbox mode via ad-hoc.… May 12, 2026 at 3:14 pm
  • Editorial Team
    Editorial Team added an answer DotNetOpenAuth is your friend. Good article on it from Rick… May 12, 2026 at 3:14 pm

Related Questions

I am trying to create an interactive command line program and it seems that
I am planning to create a component that will be able to check user's
I am trying to use the ASP.NET Dynamic Data features to generate CRUD scaffolding
I am trying to use the System.Net.Mail.MailMessage class in C# to create an email

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.