Re: Thread safety & global strings
| From: | brad lafountain | Date: | Fri, 12 Apr 2002 17:10:40 +0000 |
| Subject: | Re: Thread safety & global strings | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82686@lists.php.net to get a copy of this message | ||
--- Marcus Boerger <marcus.boerger@t-online.de> wrote:
> Correct me if i am wrong:
> We have a macros that garantees thread safety for module globals TSRMG.
> But if we use this on strings or structures that is not thread safe because
> then the lock only occurs for copying the pointer. But another thread could
> change the global value what results in efree of the former copied pointer.
>
> If i am correct we would need:
> a) to generate an error if TSRMG is used on a string
> b) a function that allows to do a thread safe copy operation with the string.
> OR
> we make TSRMG do this and all current TSRMG calls with strings have
> to explicitly call free for the copy.
From what i understand the "other thread" will have its own local copy of the
global space. so on a free it will free its own copy. Its global per thread
(httpd). And if you want a true global you need to use some kinda shared
memory.
- Brad
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/