On Tuesday, 17 January 2017 at 08:58:33 UTC, Arun Chandrasekaran
wrote:
Interesting. Why doesn't the thread get GC'd in this case even
without any reference still active?
There will be a reference to it in druntime itself:
http://dlang.org/phobos/core_thread.html#.Thread.getThis
On Tuesday, 17 January 2017 at 08:58:33 UTC, Arun Chandrasekaran
wrote:
Interesting. Why doesn't the thread get GC'd in this case even
without any reference still active?
basically 'cause there is no reliable way to correctly "abort" a
thread. nobody knows what is really going on inside it, so
On Tuesday, 17 January 2017 at 08:12:50 UTC, ketmar wrote:
import core.thread;
import core.time;
import std.stdio;
void threadStarter (string path) {
new Thread({
for (;;) {
writeln(path);
Thread.sleep(1.seconds);
}
}).start();
}
class A {
~this () { import core.stdc.
On Tuesday, 17 January 2017 at 07:53:32 UTC, thedeemon wrote:
On Monday, 16 January 2017 at 22:08:56 UTC, JN wrote:
Am I correctly understanding, that after going out of scope,
it's possible for GC to destroy my thread before the file
finishes loading? How to prevent GC from destroying my thre
On Monday, 16 January 2017 at 22:08:56 UTC, JN wrote:
Am I correctly understanding, that after going out of scope,
it's possible for GC to destroy my thread before the file
finishes loading? How to prevent GC from destroying my thread
before it finishes and make sure the file is loaded complet
On Monday, 16 January 2017 at 22:08:56 UTC, JN wrote:
Am I correctly understanding, that after going out of scope,
it's possible for GC to destroy my thread before the file
finishes loading? How to prevent GC from destroying my thread
before it finishes and make sure the file is loaded complete
I'm looking at the example code for core.thread Thread class:
new Thread({
// Codes to run in the newly created thread.
}).start();
let's imagine I put the code in a function:
void loadFileAsync(string path)
{
new Thread({
writeln(readText(path));// imagine the file is