[Mono-list] Mono: TLS. normal versus __thread

Jonathan Pryor jonpryor@vt.edu
Fri, 25 Mar 2005 06:49:13 -0500


On Thu, 2005-03-24 at 07:28 -0500, Jonathan Pryor wrote:
> On Thu, 2005-03-24 at 00:17 +0100, Michael Rasmussen wrote:
> > It apparently seems to course problems when using Mono.Posix.fork.
> > My self compiled version under Debian runs flawlessly while giving these
> > errors under Fedora Core and Suse:
> 
> Don't call Syscall.fork unless you really know what you're doing...
> 
> (Someone correct me if the following is wrong...)

After chatting with lupus on IRC, I'm apparently wrong.  Not completely
wrong, just mostly wrong...

In short, you do need to be careful about calling fork(2), but only as
careful as any C program would need to be.  Threads aren't copied when
the process forks, for example.

Consequently, a fork(2) followed immediately by an exec(2) should be
safe.  Doing anything else is getting into unknown territory: if you do
something that depends on a standard mono process, things get "iffy"
fast.

Thus, I'm not sure why you're getting differences between normal TLS and
__thread behaviors.

 - Jon