Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 17647, Synchronising Component events with the main VCL threads

by Malcolm Smith Email: Anonymous


Component events are not synchronized with the main VCL thread when used in multithreaded applications. This sample shows how to do it, regardless of event type.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For C++Builder, Version 3.0  to 6.0 1726 downloads
Copyright: No significant restrictions


Size: 260,770 bytes
Updated on Mon, 11 Mar 2002 14:03:49 GMT
Originally uploaded on Mon, 11 Mar 2002 13:58:13 GMT
SHA1 Hash: C7263260CDC230F14424167F0FDDBDB9188CCEBA
MD5 Hash: 685E3ED94B8A52A446EC2C7AD848A85C

    Explore the files in this upload

Description
Using a component in a multithreaded application needs additional work to make it thread safe. In particular, the events of the component need to be synchronized with the main VCL thread. Although work needs to be added for each event in the component, the method of achieving full synchronization is quite easy once you know how. This sample provides a demo component to weakly encrypt a file. The work is performed in a worker thread. The demonstration program provided allows you to choose a directory and have all the files encrypted using the one component. A semaphore is used to limit the number of running threads. Each file has a dynamically created progress bar added to a scrollbox. This progress bar is then updated as each file is encrypted. You can visually see the progress of each thread, visually see how many threads are running and how many are waiting. As each thread completes, the progress bar is removed from the scrollbox.

Contest entry forMultithreaded programming

For more information, see http://www.mjfreelancing.com

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Server Response from: ETNACDC03