Re: ABCL in a multi-threading environment

Blake McBride <[email protected]> Thu, 19 Sep 2024 09:48:46 -0500
Newsgroups gmane.editors.j.devel
Message-ID <CABwHSOs-UUaykP9VNsVeiJLbg6pQjx9PpmEXe-x3yyq_XwPDuA__7332.00978008739$1726757379$gmane$org@mail.gmail.com>
--000000000000bdeace06227a05a4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks Vibhu!  However, although related, I don't see how your answer
answered my question.  (Or, perhaps it does but I don't get it.)

I'm not really asking about how Java threads work or the fact that all Java
programs (including ABCL) work with threads (although they may not be
thread-safe).  I already understand that.

I'm asking:

A. If I can accomplish what I desire using the regular Java and ABCL APIs.

B. How?

Thanks!

Blake


On Thu, Sep 19, 2024 at 8:04=E2=80=AFAM Vibhu Mohindra <vibhu.mohindra@gmai=
l.com>
wrote:

> Yes, ABCL threads are Java threads underneath.
>
> Store the per-thread data in a java.lang.ThreadLocal variable, then it
> will
> be garbage collected when the thread ends.
> (If Thread A may want to access Thread B's per-thread data, then that'll
> need more thought.)
>
> The bordeaux-threads library's MAKE-LOCK creates a Java ReentrantLock.
> Follow the usual rules for portably and correctly accessing data from
> multiple threads.
> https://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html
>
> Vibhu
>

--000000000000bdeace06227a05a4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Thanks Vibhu!=C2=A0 However, although rel=
ated, I don&#39;t see how your answer answered my question.=C2=A0 (Or, perh=
aps it does but I don&#39;t get it.)<div><br></div><div>I&#39;m not really =
asking about=C2=A0how Java=C2=A0threads work or the fact that all Java prog=
rams (including ABCL) work with threads (although they may not be thread-sa=
fe).=C2=A0 I already understand that.</div><div><br></div><div>I&#39;m aski=
ng:</div><div><br></div><div>A. If I can accomplish what I desire using the=
 regular Java and ABCL APIs.</div><div><br></div><div>B. How?</div><div><br=
></div><div>Thanks!</div><div><br></div><div>Blake</div><div><br></div></di=
v><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On T=
hu, Sep 19, 2024 at 8:04=E2=80=AFAM Vibhu Mohindra &lt;<a href=3D"mailto:vi=
[email protected]">[email protected]</a>&gt; wrote:<br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">Yes, ABCL threads are Java =
threads underneath.<br>
<br>
Store the per-thread data in a java.lang.ThreadLocal variable, then it will=
 <br>
be garbage collected when the thread ends.<br>
(If Thread A may want to access Thread B&#39;s per-thread data, then that&#=
39;ll <br>
need more thought.)<br>
<br>
The bordeaux-threads library&#39;s MAKE-LOCK creates a Java ReentrantLock.<=
br>
Follow the usual rules for portably and correctly accessing data from <br>
multiple threads.<br>
<a href=3D"https://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html" =
rel=3D"noreferrer" target=3D"_blank">https://www.cs.umd.edu/~pugh/java/memo=
ryModel/jsr-133-faq.html</a><br>
<br>
Vibhu<br>
</blockquote></div></div>

--000000000000bdeace06227a05a4--