Welcome, Guest
Username: Password: Remember me
General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.
  • Page:
  • 1

TOPIC:

TList and threads 10 years 3 months ago #5053

  • Dinko
  • Dinko's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 91
  • Thank you received: 5
I have one doubt, so if anybody has some experience or opinion with following issue I would like to hear :

The question is:
I have large list (TList) filled with objects. Each object, inside, also have some list of objects and big record of data (about 8K of integer, strings etc).
For some reason I need to loop through list and calculate some numbers.
Also I need to have many threads doing the same thing - Reading objects in list and calculating data.
At some point of time it will also need update, inserrt and delete of list, but for now I only do reading.
Loading of objects I do at startup only.

Question: Is it possible for many threads to loop through TList of objects at same time. I can not have copy of objects for each thread, instead I have only one copy of objects and I want threads to "simultaneously' read the same data. I'm aware of TThreadList and I'm aware of mutexes, semaphore and stuff like that, but question is can I use the same memory from many threads at same time, without, lets say dead locks or some other strange behavior.

Thanks for opinion in advance.

Regards, Dinko

Please Log in or Create an account to join the conversation.

  • Page:
  • 1