ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEN and threads

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
lorife Posted - Mar 08 2023 : 03:25:39
Hello,
I have 2 threads which runs at the same time every x minutes.
Every now and then both processes just stop.
After many test I think have managed to find where it happens.
It seems it happens when I create the components. In fact each thread does this:

TmpDM    := TDataModule.Create(AOwner);
iev_IN   := TImageEnView.Create(tmpDM);
iev_IN2  := TImageEnView.Create(tmpDM);
iemv_OUT := TImageEnMView.Create(tmpDM);


I have managed to solve it by doing this:

ImageEN_Lock1.Acquire;

TmpDM    := TDataModule.Create(AOwner);
iev_IN   := TImageEnView.Create(tmpDM);
iev_IN2  := TImageEnView.Create(tmpDM);
iemv_OUT := TImageEnMView.Create(tmpDM);

ImageEN_Lock1.Release;


However I am not sure why it happens.
Could you help me?
To test it, I created 2 threads which runs every second. After 2-3 minutes it happens.

Thank you.
4   L A T E S T    R E P L I E S    (Newest First)
JonMRobertson Posted - Aug 24 2023 : 21:13:27
 
To test it, I created 2 threads which runs every second. After 2-3 minutes it happens.
Out of curiosity, how long are the components kept alive before you free them? Are you freeing them in the same thread that created them?
lorife Posted - Mar 10 2023 : 01:55:09
I will try and send it to you
MaribelSpence Posted - Mar 09 2023 : 05:15:19
For a deeper understanding of multithreading and resource recovery in Delphi, I suggest studying the documentation on TMultiReadExclusiveWriteSynchronizer, TThread, TMonitor and other multithreaded classes in Delphi.
xequte Posted - Mar 08 2023 : 19:04:43
Hi

Are you able to create a very simple demo that shows the issue?

Nigel
Xequte Software
www.imageen.com