title: How can I pass std.stdio.File to another Thread via spawn?
body: <p>I am spawning a process using D's std.process.pipeProcess function, which gives me std.stdio.File structs for the process's input and output respectively. I need to be able to process output from the process, while at the same time process input from my own console.</p>
  
  <p>Since there is no way to do a non-blocking readln() on a File struct, I need to spawn another thread to do a blocking wait for me, and then message pass it to the main thread via std.concurrency.</p>
  
  <p>My problem is that when I pass it like this:</p>
  
  <pre><code>spawn(&amp;myConsoleListenFunction, pipe.stdout)
  </code></pre>
  
  <p>The compiler says that that "Aliases to mutable thread-local data are not allowed". I know that means that I need to cast to shared, but I can't do that either because when I try to cast the File to shared I get this:</p>
  
  <pre><code>C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(487,5): Error: non-shared method std.stdio.File.~this is not callable using a shared object
  source\app.d(67,26): Error: template std.concurrency.spawn cannot deduce function from argument types !()(void function(File f, string prefix), shared(File), string), candidates are:
  C:\D\dmd2\windows\bin\..\..\src\phobos\std\concurrency.d(487,5):        std.concurrency.spawn(F, T...)(F fn, T args) if (isSpawnable!(F, T))
  </code></pre>
  
  <p>I also tried passing the File as __gshared, which results in the same "Alias" message.</p>