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

  • SEARCH
  • Home
  • 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 7430437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:08:26+00:00 2026-05-29T09:08:26+00:00

What would be the best programming practice for this case: I have a linkedlist

  • 0

What would be the best programming practice for this case:

I have a linkedlist with file-objects, once in a while incoming file objects are added to this list (AddThread).

These file-objects need to be “processed”, supposedly by another thread (ProcessThread). So whenever file-objects are added to the list, they need to be processed one at a time, while other file-objects still can be added to the list.

During processing, an item from the list is read and afterwards removed from that list. Processing stops whenever the list is empty, and starts again if new items are added.

How I see it:

Whenever a change is applied to the list (item added), a change event is fired. This event wakes up the ProcessThread. The ProcessThreads locks the list for a small amount of time to read it and releases the lock again. When the file-object is processed it locks it again to quickly remove the item from the list and unlocks it.
When there are no file-objects anymore in the list, the ProcessThread is set to sleep.

Is this the right way to do it, or are there other better options..?

Greets Daan

Edit: I use a linkedlist, because then I can add a file-object on the beginning or the end of the list, so that it is processed before/after others. Processing can take up to a minute, depending on the networkload. Sometimes it will fail, and it needs to be processed again.

  • 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. Editorial Team
    Editorial Team
    2026-05-29T09:08:27+00:00Added an answer on May 29, 2026 at 9:08 am

    OK, after reading the other posts and updates, how about two ‘plain’ queues, (low and high priority), a mutex/CS lock and a semaphore, making up a priority blocking queue? To add a file-object, acquire the lock, push the file-object onto one of the queues, release the lock, signal the semaphore. In the process-thread/s, wait on the semaphore, acquire the lock, TryTake from the high-priority queue and, if this fails, Take from the low-priority queue, then release the lock and process the file-object.

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

Sidebar

Related Questions

I would like to know what are the best practice programming tasks in relation
This is not a programming question, but a question on the best practice for
I was wondering what would be the best programming practice for jQuery. Most jquery
What would be the best way to detect what programming language is used in
What would be best practice to localize your ASP.NET MVC application? I would like
I have the following situation I think would be best to show in sample
In Java, what would the best way be to have a constantly listening port
Hey all, what would be best practice for clipping the bottom borders of a
I have been dealing with this situation for a while now. I have been
I have a best practices question. I realize this is subjective but wanted to

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.