Passing Command Line Arguments to a new Thread

2014-08-07 Thread Nordlöw
What is the best way to forward a string[] as argument to a function called through std.concurrency.spawn(). I need this in the following example where I start the vibe.d event loop in the main thread (the only way I've managed to get runEventLoop() to work) and run my other program logic in

Re: Passing Command Line Arguments to a new Thread

2014-08-07 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Aug 07, 2014 at 06:23:24PM +, Nordlöw via Digitalmars-d-learn wrote: What is the best way to forward a string[] as argument to a function called through std.concurrency.spawn(). I need this in the following example where I start the vibe.d event loop in the main thread (the only

Re: Passing Command Line Arguments to a new Thread

2014-08-07 Thread via Digitalmars-d-learn
On Thursday, 7 August 2014 at 18:33:40 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Thu, Aug 07, 2014 at 06:23:24PM +, Nordlöw via Digitalmars-d-learn wrote: What is the best way to forward a string[] as argument to a function called through std.concurrency.spawn(). I need this in

Re: Passing Command Line Arguments to a new Thread

2014-08-07 Thread Nordlöw
On Thursday, 7 August 2014 at 18:38:37 UTC, Marc Schütz wrote: But this shouldn't be necessary, right? It's a mutable slice to immutable data, but the slice is passed by value, so no mutable sharing takes place. I agree. I'll use .idup anyhow. For this work I however have to do void

Re: Passing Command Line Arguments to a new Thread

2014-08-07 Thread Johannes Blume via Digitalmars-d-learn
On Thursday, 7 August 2014 at 18:38:37 UTC, Marc Schütz wrote: But this shouldn't be necessary, right? It's a mutable slice to immutable data, but the slice is passed by value, so no mutable sharing takes place. The elements of the slice itself are mutable, you can e.g. assign some other

Re: Passing Command Line Arguments to a new Thread

2014-08-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2014-08-07 20:23, Nordlöw wrote: What is the best way to forward a string[] as argument to a function called through std.concurrency.spawn(). What about just accessing core.runtime.Runtime.args from the new thread? -- /Jacob Carlborg

Re: Passing Command Line Arguments to a new Thread

2014-08-07 Thread Jeremy DeHaan via Digitalmars-d-learn
On Thursday, 7 August 2014 at 18:23:26 UTC, Nordlöw wrote: What is the best way to forward a string[] as argument to a function called through std.concurrency.spawn(). I need this in the following example where I start the vibe.d event loop in the main thread (the only way I've managed to get

Re: Passing Command Line Arguments to a new Thread

2014-08-07 Thread via Digitalmars-d-learn
On Thursday, 7 August 2014 at 19:08:37 UTC, Johannes Blume wrote: On Thursday, 7 August 2014 at 18:38:37 UTC, Marc Schütz wrote: But this shouldn't be necessary, right? It's a mutable slice to immutable data, but the slice is passed by value, so no mutable sharing takes place. The elements