<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">Actually the docs here <a href="https://tip.golang.org/src/runtime/cgocall.go">https://tip.golang.org/src/runtime/cgocall.go</a> is the definitive source.  </div><div dir="ltr"><br><blockquote type="cite">On Jun 27, 2023, at 6:59 AM, Robert Engels <rengels@ix.netcom.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div dir="ltr"></div><div dir="ltr">See <a href="https://dave.cheney.net/tag/gomaxprocs">https://dave.cheney.net/tag/gomaxprocs</a> and GOMAXPROCS. I’m sure there are other sources. It is a thoroughly discussed aspect of using CGO. </div><div dir="ltr"><br><blockquote type="cite">On Jun 27, 2023, at 6:18 AM, Danish Nawab <dnawab@outlook.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">



<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
> <span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, "system-ui", Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; display: inline !important; color: rgb(36, 36, 36); background-color: rgb(255, 255, 255);" class="ContentPasted0">Go
 also locks the carrier thread in this arbitrary native case - and simply spawns a new one if needed.</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, "system-ui", Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; display: inline !important; color: rgb(36, 36, 36); background-color: rgb(255, 255, 255);" class="ContentPasted0"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, "system-ui", Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; display: inline !important; color: rgb(36, 36, 36); background-color: rgb(255, 255, 255);" class="ContentPasted0">Do
 you have a source for this information? I would like to develop an understanding of the similarities/differences between the two implementations. </span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Robert Engels <rengels@ix.netcom.com><br>
<b>Sent:</b> Monday, June 26, 2023 4:11 PM<br>
<b>To:</b> Ron Pressler <ron.pressler@oracle.com><br>
<b>Cc:</b> Danish Nawab <dnawab@outlook.com>; loom-dev@openjdk.org <loom-dev@openjdk.org><br>
<b>Subject:</b> Re: [External] : Re: Native interop with Virtual Threads</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Go also locks the carrier thread in this arbitrary native case - and simply spawns a new one if needed.<br>
<br>
> On Jun 26, 2023, at 6:02 PM, Ron Pressler <ron.pressler@oracle.com> wrote:<br>
> <br>
> <br>
> <br>
>> On 26 Jun 2023, at 17:45, Danish Nawab <dnawab@outlook.com> wrote:<br>
>> <br>
>> Thanks Ron. <br>
>> <br>
>> What about native code that doesn’t make an upcall but does a blocking operation directly (via OS syscalls or similar)? Are such cases also rare?
<br>
> <br>
> Yes. But supporting those — even if there was reason to — would have been even harder, as Java has no control or knowledge over what native code does.<br>
> <br>
>> <br>
>> What would be the advice if someone is making blocking calls from their downcalls? It might not always be possible to rewrite it in Java.
<br>
> <br>
> If those operations are both frequent and lengthy, they shouldn’t be done on virtual threads.<br>
> <br>
> — Ron<br>
</div>
</span></font></div>


</div></blockquote></div></blockquote></body></html>