Re: Thread pools

2015-07-22 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 14:28:48 UTC, Chris wrote: What would be the best way to manage different threads (spawned via std.concurrency), e.g. to tell them to stop at once, once a new command comes in? A thread pool? How would that look like in D? I feel my knowledge of D threads is still

Re: Thread pools

2015-07-22 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 15:51:23 UTC, Chris wrote: On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: On Wednesday, 22 July 2015 at 14:28:48 UTC, Chris wrote: What would be the best way to manage different threads (spawned via std.concurrency), e.g. to tell them to stop at

Re: Thread pools

2015-07-22 Thread Chris via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: On Wednesday, 22 July 2015 at 14:28:48 UTC, Chris wrote: What would be the best way to manage different threads (spawned via std.concurrency), e.g. to tell them to stop at once, once a new command comes in? A thread pool? How

Re: Sending an immutable object to a thread

2015-07-22 Thread Frank Pagliughi via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 09:04:49 UTC, Marc Schütz wrote: But as long as the original pointer is still on the stack, that one _will_ keep the object alive. It is only a problem if all pointers to a GC managed object are stored in places the GC isn't informed about. Sorry, I have

Re: Thread pools

2015-07-22 Thread via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 16:16:36 UTC, John Colvin wrote: On Wednesday, 22 July 2015 at 15:51:23 UTC, Chris wrote: On Wednesday, 22 July 2015 at 15:41:06 UTC, Alex Parrill wrote: [...] Thanks. I'm dealing with nested threads at the moment. main { spawn(thread1) { // Does some

Re: Sending an immutable object to a thread

2015-07-22 Thread rsw0x via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 17:17:17 UTC, Frank Pagliughi wrote: On Wednesday, 22 July 2015 at 09:04:49 UTC, Marc Schütz wrote: But as long as the original pointer is still on the stack, that one _will_ keep the object alive. It is only a problem if all pointers to a GC managed object are

How to get *32mscoff libraries for phobos?

2015-07-22 Thread Taylor Hillegeist via Digitalmars-d-learn
I have tried to build this and failed miserably. I have some questions? What make do you use? digital mars, gnu. what tools do you need? is it possible? I also failed to build zlib32coff.lib make[2]: *** No rule to make target `zlib32mscoff.lib'. Stop. I could say more but it probably

Re: Passing struct and struct[] into a template

2015-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 22, 2015 04:29:23 Taylor Gronka via Digitalmars-d-learn wrote: I have a template function, and I want it to do something if the input variable is a list of structs, and something else if the input is a struct. If you want a template to be different for different types, then

Re: Sending an immutable object to a thread

2015-07-22 Thread via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 21:50:35 UTC, rsw0x wrote: On Tuesday, 21 July 2015 at 21:44:07 UTC, rsw0x wrote: On Sunday, 19 July 2015 at 17:12:07 UTC, rsw0x wrote: [...] wow, I don't even remember posting this. This is (mostly) wrong, but I'm unsure if a pointer to another pointer on the

Re: Code Coverage Analysis, how do I skip (ignore) a line?

2015-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 22, 2015 02:19:52 antropod via Digitalmars-d-learn wrote: I want my coverage analysis to be 100%, how do I skip lines like assert(0); from being counted? AFAIK, there is no way to so, and I've mentioned that problem to Walter before, so I would have expected him to mention

Re: Measuring Execution time

2015-07-22 Thread Clayton via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 09:32:15 UTC, John Colvin wrote: On Wednesday, 22 July 2015 at 09:23:36 UTC, Clayton wrote: [...] The normal way of doing this would be using std.datetime.StopWatch: StopWatch sw; sw.start(); algorithm(); long exec_ms = sw.peek().msecs; Much

Measuring Execution time

2015-07-22 Thread Clayton via Digitalmars-d-learn
How does one represent Duration in only Micro-seconds, or milliseconds. Trying to measure the execution time of an algorithm and I get 4 ms, 619 μs, and 8 hnsecs , I want to sum all these and get total hnsecs or μs . I would also appreciate advise on whether this is the best way to measure

Re: Measuring Execution time

2015-07-22 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 09:23:36 UTC, Clayton wrote: How does one represent Duration in only Micro-seconds, or milliseconds. Trying to measure the execution time of an algorithm and I get 4 ms, 619 μs, and 8 hnsecs , I want to sum all these and get total hnsecs or μs . I would also

std.net.curl and PATCH

2015-07-22 Thread Andrea Fontana via Digitalmars-d-learn
It seems that PATCH http method is missing from std.net.curl http methods. No way to use it?

Re: How to get *32mscoff libraries for phobos?

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 23:39:46 UTC, Jonathan M Davis wrote: On Wednesday, July 22, 2015 20:27:35 Taylor Hillegeist via Digitalmars-d-learn wrote: I have tried to build this and failed miserably. I have some questions? What make do you use? digital mars, gnu. what tools do you need? is

Re: How to get *32mscoff libraries for phobos?

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 July 2015 at 01:39:05 UTC, Mike Parker wrote: post at [1] where Rainer shared the relevant bits of a batch Gah, hate it when I forget the links. [1] http://forum.dlang.org/post/m456t5$2jc4$1...@digitalmars.com

Re: C bindings: typedef struct conflicts with method

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 05:53:26 UTC, yawniek wrote: i tried to automagically create bindings for librdkafka (https://github.com/edenhill/librdkafka) with dstep. now the code contains typedefs structs with the same name as methods: ``` typedef struct rd_kafka_metadata { int

Re: How to get *32mscoff libraries for phobos?

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 20:27:37 UTC, Taylor Hillegeist wrote: I have tried to build this and failed miserably. I have some questions? What make do you use? digital mars, gnu. what tools do you need? is it possible? I also failed to build zlib32coff.lib make[2]: *** No rule to make

Re: Getting this to work similar to self in Python

2015-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 22, 2015 23:19:35 nurfz via Digitalmars-d-learn wrote: Hmm, is there a specific reason aside from the encapsulation violation? It seems needlessly complicated. If you have someone/something that has direct access to your source code, isn't a getter/setter the least of your

Connection to server socket Invalid argument

2015-07-22 Thread VlasovRoman via Digitalmars-d-learn
I have some code. //client.d import std.stdio; import std.socket; import std.conv; void main() { Socket client = new TcpSocket(AddressFamily.INET); autoaddr = new InternetAddress(localhost, 2021); autoaddrServer = new InternetAddress(localhost, 2017);

Getting this to work similar to self in Python

2015-07-22 Thread nurfz via Digitalmars-d-learn
How could I get this D code to work similar to this Python code? So, here is the D code: import std.stdio; class Vehicle { int speed; void printSpeed() { writeln(this.speed); } } class Airplane: Vehicle { int speed = 100; }

Re: Getting this to work similar to self in Python

2015-07-22 Thread nurfz via Digitalmars-d-learn
Hmm, is there a specific reason aside from the encapsulation violation? It seems needlessly complicated. If you have someone/something that has direct access to your source code, isn't a getter/setter the least of your concerns? Does the @property decorator incur a large runtime cost?

Re: Getting this to work similar to self in Python

2015-07-22 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 22:22:02 UTC, nurfz wrote: How could I get this D code to work similar to this Python code? So, here is the D code: import std.stdio; class Vehicle { int speed; void printSpeed() { writeln(this.speed); } }

Re: Getting this to work similar to self in Python

2015-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 22, 2015 22:22:00 nurfz via Digitalmars-d-learn wrote: How could I get this D code to work similar to this Python code? So, here is the D code: import std.stdio; class Vehicle { int speed; void printSpeed() {

Re: How to get *32mscoff libraries for phobos?

2015-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 22, 2015 20:27:35 Taylor Hillegeist via Digitalmars-d-learn wrote: I have tried to build this and failed miserably. I have some questions? What make do you use? digital mars, gnu. what tools do you need? is it possible? I also failed to build zlib32coff.lib make[2]: ***

Re: Sending an immutable object to a thread

2015-07-22 Thread rsw0x via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 09:04:49 UTC, Marc Schütz wrote: On Tuesday, 21 July 2015 at 21:50:35 UTC, rsw0x wrote: On Tuesday, 21 July 2015 at 21:44:07 UTC, rsw0x wrote: [...] addendum: http://dlang.org/garbage.html [...] [...] I believe this implies that it would *not* keep the

Thread pools

2015-07-22 Thread Chris via Digitalmars-d-learn
What would be the best way to manage different threads (spawned via std.concurrency), e.g. to tell them to stop at once, once a new command comes in? A thread pool? How would that look like in D? I feel my knowledge of D threads is still a bit limited.