[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KStringHandler: stateless/reentrant/thread-safe?
From:       Frank Reininghaus <frank78ac () googlemail ! com>
Date:       2012-10-26 19:06:35
Message-ID: CAFoZWWiyokn+C22dv-1qzC7ym3QJoo-h_NOOiUEZ258NjaWt5g () mail ! gmail ! com
[Download RAW message or body]

Hi Thiago,

Am 26.10.2012 20:42 schrieb "Thiago Macieira":
>
> On sexta-feira, 26 de outubro de 2012 20.15.46, Frank Reininghaus wrote:
> > KStringHandler [3] say that "The methods here are completely
> > stateless", which sounds a bit vague. Does anyone mind if I add "This
> > function is reentrant" to the docs of
>
> Isn't that a bit redundant? If it's stateless, it has no state to
conflict with
> other threads, so it's thread-safe by definition.
>
> But I'd be in favour of *replacing* the stateless mention with just saying
> that they're thread-safe.

Yes, I thought the same, but then I wasn't entirely sure if all these
functions really are thread-safe. Some of them have const static variables,
which might be initialised the first time the function is called AFAIK. I
don't know if that's guaranteed to work if the functions can be called from
multiple threads. But you can probably answer that question ;-)

Best regards,
Frank

[Attachment #3 (text/html)]

<p>Hi Thiago,</p>
<p>Am 26.10.2012 20:42 schrieb &quot;Thiago Macieira&quot;:<br>
&gt;<br>
&gt; On sexta-feira, 26 de outubro de 2012 20.15.46, Frank Reininghaus wrot=
e:<br>
&gt; &gt; KStringHandler [3] say that &quot;The methods here are completely=
<br>
&gt; &gt; stateless&quot;, which sounds a bit vague. Does anyone mind if I =
add &quot;This<br>
&gt; &gt; function is reentrant&quot; to the docs of<br>
&gt;<br>
&gt; Isn&#39;t that a bit redundant? If it&#39;s stateless, it has no state=
 to conflict with<br>
&gt; other threads, so it&#39;s thread-safe by definition.<br>
&gt;<br>
&gt; But I&#39;d be in favour of *replacing* the stateless mention with jus=
t saying<br>
&gt; that they&#39;re thread-safe.</p>
<p>Yes, I thought the same, but then I wasn&#39;t entirely sure if all thes=
e functions really are thread-safe. Some of them have const static variable=
s, which might be initialised the first time the function is called AFAIK. =
I don&#39;t know if that&#39;s guaranteed to work if the functions can be c=
alled from multiple threads. But you can probably answer that question ;-)<=
/p>

<p>Best regards,<br>
Frank<br>
</p>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic