Le 17/01/2014 12:53, Michael Van Canneyt a écrit :


On Fri, 17 Jan 2014, Antonio Fortuny wrote:

Hi All.

Maybe not a Lazarus/FPC specific question but development whill be done using Lazarus/FPC. I wonder if I can build an application (service) having multiple threads running (Indy TCP/IP server, multiple connections) and every thread calls some functions in a library (dll on Windows, .so on Linux) I can imagine that if every thread loads dynamically the library it should work as I assume that a library shares its code among all callers (processes ?) but each instance has its own data segment tied tp the calling process (thread ?).

The data segment is tied to the process, not to the thread.

So global variables in the DLL are shared by all threads of the calling process. If you define threadvars in the DLL, they will normally be specific to threads of the calling program (just as they would be if the library created the thread).
Ok, got it. The library has to be made thread safe as well. This was already in my mind.
Tnaks Michael.

Antonio.


Michael.

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to