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 472701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:06:49+00:00 2026-05-13T00:06:49+00:00

I have some operations which are based on TThreads. Now I need to create

  • 0

I have some operations which are based on TThreads. Now I need to create the thread containing the list of jobs to be done, then firing each one as soon as the previous finishes… How should I write it? I can’t allow the threads to be ran simultaneously as there might be over 10 000 operations to be done.
It is quite hard to find documented examples of TEvent and other syncing objects…
Hope I’ll find some help here …

Thanks in advance,
michal

  • 1 1 Answer
  • 1 View
  • 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-13T00:06:50+00:00Added an answer on May 13, 2026 at 12:06 am

    Don’t base your operations on threads. This is the wrong design. Instead you should create a base class for your operation, which exposes a method to perform the operation. Write descendant classes to implement the concrete operations. Don’t make any assumptions about thread contexts, alway use critical sections or similar synchronization objects to protect access to shared resources. More importantly, try to avoid shared resources, or at least try to make shared resources read-only, so that locking isn’t necessary.

    With that design in place it becomes possible to perform each operation in the VCL thread by calling the operation method directly, to use a TThread descendant class to perform an operation in its own thread (what you seem to have now), or to schedule all operations on a thread pool. The number of threads in the pool can be adjusted at runtime to match the nature of the operations (processor-bound or I/O-bound) and the number of processor cores the system has. And to answer your question: it is even possible to completely serialize the operations by forcing the pool to use a single thread. Basically you can completely change the way your operations are performed without changing them at all.

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

Sidebar

Related Questions

I have some Java code which performs bitwise operations on a BitSet. I have
I have a table on which I want to perform some operations every hour.
I have to do a background process which will perform some operations.. while this
I have two list operations which I would like to ask for help. The
In WPF app I have a timer which cyclically performs some database quering operations
I have some C# unit tests that perform some float/double operations and I would
I have a set of objects I'd like to do some operations on, in
I have bat-file, that make some operations. How to run this file from Delphi
I have a global pointer variable char* pointer = new char[500]; /* some operations...
I have a php that makes some maintenance operations in my web and I

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.