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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEN and threads
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

lorife

Italy
41 Posts

Posted - Mar 08 2023 :  03:25:39  Show Profile  Reply
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.

xequte

37566 Posts

Posted - Mar 08 2023 :  19:04:43  Show Profile  Reply
Hi

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

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

MaribelSpence

USA
1 Posts

Posted - Mar 09 2023 :  05:15:19  Show Profile  Reply
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.
Go to Top of Page

lorife

Italy
41 Posts

Posted - Mar 10 2023 :  01:55:09  Show Profile  Reply
I will try and send it to you
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: