Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a Delphi global procedure threadsafe

If two or more threads call a standard Delphi/Pascal procedure (not a method of an object), is this threadsafe ? There is no instance data, just local variables in the procedure.
My guess is that the local storage being used by one thread could be corrupted by the other thread.

like image 455
David Moorhouse Avatar asked Feb 28 '14 00:02

David Moorhouse


1 Answers

Local storage is maintained on the stack, which is unique to each thread. If no global data is being manipulated by the routine, it is safe.

like image 79
Mason Wheeler Avatar answered Sep 25 '22 07:09

Mason Wheeler