[MLton] globals + threads

Jeffrey Murphy <[email protected]> Wed, 9 Oct 2019 23:02:46 -0400
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <[email protected]>
--===============3510619420806510456==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_33CF550A-B393-4D84-BA86-610440ECDB62"


--Apple-Mail=_33CF550A-B393-4D84-BA86-610440ECDB62
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hi,=20

Context: an SML application that is executing in multiple posix threads. =
Similar to how multimlton copythread=E2=80=99s the current thread to a =
new one and then executes it in a new posix thread. We are using the =
c-codegen.

When thinking about how to handle globals, I noticed that multimlton =
uses the same gcstate->globals pointer across posix threads. Is this =
safe (I=E2=80=99m assuming it is)? When looking at the C-codegen output, =
I noticed that the G() macro will be on the LHS and so I=E2=80=99m =
wondering if there are potential races I should be concerned about?

$ git rev-parse --short HEAD
05004a0
(May 15 commit)


jeff



--Apple-Mail=_33CF550A-B393-4D84-BA86-610440ECDB62
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" =
class=3D"">Hi,&nbsp;<div class=3D""><br class=3D""></div><div =
class=3D"">Context: an SML application that is executing in multiple =
posix threads. Similar to how multimlton copythread=E2=80=99s the =
current thread to a new one and then executes it in a new posix thread. =
We are using the c-codegen.</div><div class=3D""><br class=3D""></div><div=
 class=3D"">When thinking about how to handle globals, I noticed that =
multimlton uses the same gcstate-&gt;globals pointer across posix =
threads. Is this safe (I=E2=80=99m assuming it is)? When looking at the =
C-codegen output, I noticed that the G() macro will be on the LHS and so =
I=E2=80=99m wondering if there are potential races I should be concerned =
about?</div><div class=3D""><br class=3D""></div><div class=3D""><pre =
style=3D"box-sizing: inherit; margin-top: 0px; margin-bottom: 0px; =
padding: 15px; border-width: 0px 0px 0px 1px; border-left-style: solid; =
border-left-color: rgb(229, 229, 229); outline: 0px; font-size: 14px; =
vertical-align: baseline; background-color: rgb(254, 254, 254); =
font-family: monospace, sans-serif; white-space: pre-wrap; =
overflow-wrap: break-word; overflow: auto; color: rgb(85, 85, 85); =
font-variant-ligatures: normal; orphans: 2; widows: 2; =
background-position: initial initial; background-repeat: initial =
initial;" class=3D"">$ git rev-parse --short HEAD
05004a0
(May 15 commit)</pre><div class=3D""><br class=3D""></div></div><div =
class=3D""><br class=3D""></div><div class=3D"">jeff</div><div =
class=3D""><br class=3D""></div><div class=3D""><br =
class=3D""></div></body></html>=

--Apple-Mail=_33CF550A-B393-4D84-BA86-610440ECDB62--


--===============3510619420806510456==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============3510619420806510456==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
MLton-devel mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-devel

--===============3510619420806510456==--