Copying files which the main thread adds to a stringlist using a thread

后端 未结 3 2003
不思量自难忘°
不思量自难忘° 2021-02-04 22:12

I have a web creation program which, when building a site, creates hundreds of files.

When the internet root folder is situated on the local pc, the program runs fine.

3条回答
  •  一生所求
    2021-02-04 23:01

    A good start for using thread is Delphi is found at the Delphi about site

    In order to make your solution work, you need a job queue for the worker thread. A stringlist can be used. But in any case you need to guard the queue so that only one thread can write to it at any single moment. Even if the writing thread is suspended.

    Your application writes to the queue. So there must be a guarded write method.

    Your thread reads and removes from the queue. So there must be a guarded read/remove method.

    You can use a critical section to make sure only one of these has access to the queue at any single moment.

提交回复
热议问题