Re: Atomic updates

2013-01-22 Thread qznc
On Tuesday, 22 January 2013 at 00:10:22 UTC, bearophile wrote: I suggest to put your code on Rosettacode now, and then we'll do the changes there... As you see in other answers, both me and monarch_dodra have other ideas for improvements. Ok, posted it.

Re: Atomic updates

2013-01-22 Thread cal
On Tuesday, 22 January 2013 at 08:12:03 UTC, qznc wrote: On Tuesday, 22 January 2013 at 00:10:22 UTC, bearophile wrote: I suggest to put your code on Rosettacode now, and then we'll do the changes there... As you see in other answers, both me and monarch_dodra have other ideas for

Re: Pull 1019

2013-01-22 Thread Namespace
On Friday, 18 January 2013 at 13:13:03 UTC, Jacob Carlborg wrote: On 2013-01-18 14:07, Namespace wrote: Despite the danger that this annoy you probably: What about pull 1019 (https://github.com/D-Programming-Language/dmd/pull/1019)? I'm still quite new with Git so I do not know exactly what 1

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 09:26:25 UTC, cal wrote: On Tuesday, 22 January 2013 at 08:12:03 UTC, qznc wrote: On Tuesday, 22 January 2013 at 00:10:22 UTC, bearophile wrote: I suggest to put your code on Rosettacode now, and then we'll do the changes there... As you see in other answers,

TDPL message passing: OwnerFailed?

2013-01-22 Thread monarch_dodra
I was trying to do a simple program to test message passing. Basically, I have 1 owner, and 2 slave threads. I'm facing two problems: 1 ) First, I want the slaves to be informed of when the master dies in an abnormal way. TDPL suggest OwnerFailed, but apparently, the out of band exception

Re: Pull 1019

2013-01-22 Thread mist
On Tuesday, 22 January 2013 at 09:29:07 UTC, Namespace wrote: On Friday, 18 January 2013 at 13:13:03 UTC, Jacob Carlborg wrote: On 2013-01-18 14:07, Namespace wrote: Despite the danger that this annoy you probably: What about pull 1019 (https://github.com/D-Programming-Language/dmd/pull/1019)?

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 10:27:58 UTC, bearophile wrote: I have modified a little the code on RosettaCode (no changes in the logic). monarch_dodra: Avoids deadlock. imagine 2 threads: a: from 2 to 5. b: from 5 to 2. If both threads acquire their first lock, then you have a dead

Re: Atomic updates

2013-01-22 Thread bearophile
monarch_dodra: That's a good point, and I'm sure we could also have a version of D that could also do it that way. Someone is willing to create that second version for RosettaCode? I have modified a bit the second and third Go versions on Rosettacode, now there are 20 buckets and it shows

Re: Atomic updates

2013-01-22 Thread bearophile
I have modified a bit the second and third Go versions on Rosettacode, The changes on the Go versions are only on my local copies of the code. Bye, bearophile

Re: Error by building druntime

2013-01-22 Thread Namespace
Hey, me again. I cloned dmd from git head and try to build it with: make -fwin32.mak release But I get these errors: dmc -c -Ibackend;tk -DMARS -cpp -D -g -DUNITTEST -e -wx -DDM_TARGET_CPU_X86=1 - I. backend\cgelem elerr, ^ elxxx.c(3) : Error: need explicit cast to

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread Martin Drasar
On 22.1.2013 11:08, monarch_dodra wrote: I was trying to do a simple program to test message passing. Basically, I have 1 owner, and 2 slave threads. I'm facing two problems: 1 ) First, I want the slaves to be informed of when the master dies in an abnormal way. TDPL suggest

Re: Atomic updates

2013-01-22 Thread bearophile
I have tried to scope the Mutex, but the D code gets a little slower, I don't know why: 5,6d5 import std.typecons: scoped; import std.traits: ReturnType; 19,22c17,19 ReturnType!(scoped!Mutex) mtx; alias this = value; } // pragma(msg, Bucket.sizeof); // 52 bytes

Re: Atomic updates

2013-01-22 Thread qznc
On Tuesday, 22 January 2013 at 10:27:58 UTC, bearophile wrote: The Go language has four different solutions, one of them is: http://rosettacode.org/wiki/Atomic_updates#Lock-free From the site: This version uses no locking for the phase where the two clients are updating the buckets. Instead

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 14:10:14 UTC, qznc wrote: On Tuesday, 22 January 2013 at 10:27:58 UTC, bearophile wrote: The Go language has four different solutions, one of them is: http://rosettacode.org/wiki/Atomic_updates#Lock-free From the site: This version uses no locking for the

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread Ali Çehreli
On 01/22/2013 04:26 AM, Martin Drasar wrote: On 22.1.2013 11:08, monarch_dodra wrote: I was trying to do a simple program to test message passing. wouldn't this help you? http://dlang.org/phobos/std_concurrency.html#.spawnLinked The following chapter may be helpful as well:

Re: Error by building druntime

2013-01-22 Thread Namespace
Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the wiki.

Re: Error by building druntime

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 14:56:16 UTC, Namespace wrote: Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the wiki. Do you have the latest github dmd? Could just be that you pulled the code at the exact moment it wasn't compiling.

Re: Atomic updates

2013-01-22 Thread bearophile
monarch_dodra: D has attomic swap operations too, AFAIK. In core.atomic I think there is what's needed, cas and atomicOp: https://github.com/D-Programming-Language/druntime/blob/master/src/core/atomic.d Do you know why the site doesn't show the ddocs here?

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 12:27:12 UTC, Martin Drasar wrote: Hi, wouldn't this help you? http://dlang.org/phobos/std_concurrency.html#.spawnLinked According to documentation: Executes the supplied function in a new context represented by Tid. This new context is linked to the calling

Re: Atomic updates

2013-01-22 Thread Martin Drasar
On 22.1.2013 16:00, bearophile wrote: Do you know why the site doesn't show the ddocs here? http://dlang.org/phobos/core_atomic.html Wild guess, but couldn't it be because the ddoc documentation is inside version(CoreDdoc) and not processed? Martin

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 14:58:50 UTC, monarch_dodra wrote: On Tuesday, 22 January 2013 at 14:56:16 UTC, Namespace wrote: Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the wiki. Do you have the latest github dmd? Could just be that you

Re: Atomic updates

2013-01-22 Thread bearophile
Martin Drasar: Wild guess, but couldn't it be because the ddoc documentation is inside version(CoreDdoc) and not processed? The question then becomes why is that version(CoreDdoc) used :-) Bye, bearophile

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 15:10:14 UTC, Namespace wrote: On Tuesday, 22 January 2013 at 14:58:50 UTC, monarch_dodra wrote: On Tuesday, 22 January 2013 at 14:56:16 UTC, Namespace wrote: Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the

Re: Atomic updates

2013-01-22 Thread cal
On Tuesday, 22 January 2013 at 09:47:25 UTC, monarch_dodra wrote: Avoids deadlock. imagine 2 threads: a: from 2 to 5. b: from 5 to 2. If both threads acquire their first lock, then you have a dead lock, and your program is basically dead. By always locking low first, you avoid the deadlock

Re: Atomic updates

2013-01-22 Thread ixid
On Monday, 21 January 2013 at 20:35:16 UTC, bearophile wrote: qznc: Code: http://dpaste.dzfl.pl/e6615a53 Any comments or improvements? I have reformatted your code a little, according to the style used in all other D entries of RosettaCode: http://codepad.org/ceDyQ8lE The usage of a

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 18:10:27 UTC, cal wrote: On Tuesday, 22 January 2013 at 09:47:25 UTC, monarch_dodra wrote: Avoids deadlock. imagine 2 threads: a: from 2 to 5. b: from 5 to 2. If both threads acquire their first lock, then you have a dead lock, and your program is basically

Re: Atomic updates

2013-01-22 Thread bearophile
ixid: I note you always seem to use in in your functions and on reddit seemed to imply that this was the idiomatic way of using D yet I recall Jonathan M Davies posting that using in was a bad idea. I think in is supposed to be(come) idiomatic, because it's short, and it's supposed to

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread Ali Çehreli
On 01/22/2013 09:04 AM, monarch_dodra wrote: I'm getting some errors with this program: I can not reproduce this problem on Linux. Not with -m64 nor with -m32. I don't think the following is necessary but it has been a workaround for me in the past: import core.thread; void main(string[]

S-Expressions

2013-01-22 Thread qznc
After Atomic Updates from rosettacode.org, here is S-Expressions. Problem: http://rosettacode.org/wiki/S-Expressions Code: http://dpaste.dzfl.pl/fd485808 Comments, improvements?

Re: Error by building druntime

2013-01-22 Thread Namespace
Maybe I should describe _exactly_ what I did to earn help. I make a new directory with: mkdir d then I wrote git clone git://github.com/D-Programming-Language/dmd.git git clone git://github.com/D-Programming-Language/druntime.git git clone git://github.com/D-Programming-Language/phobos.git dir

Re: Error by building druntime

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 20:47:46 UTC, Namespace wrote: So what is wrong now? A few days ago it works fine. I don't understand that. :/ Strange. That's what I do (verbatim), so it should work. Which make is being called? What is your DMC? Could you try it with *only* X/dm/bin in you

Re: Error by building druntime

2013-01-22 Thread monarch_dodra
No idea. Just updated my own dmd sources. I rebuilt it fine with both dmc 852c and 856c, in both release non-release :/

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 21:35:48 UTC, Namespace wrote: dmc prints before Digital Mars Compiler Version 8.42n and also after I replaced it with your version. Have I forget something? And still the same error. That weird. oO Ah, I forgot, sorry. I'm using: Digital Mars Make Version 5.06

Re: Win32 api with 2.061

2013-01-22 Thread David
Am 22.01.2013 23:25, schrieb cal: const uint WINVER = blah try: static const uint WINVER = blah But I have no idea why it changed

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 22:15:13 UTC, Namespace wrote: In my distress I have now tried with dmd_msc_vs10. I get no such error but others: 1cl : Befehlszeile warning D9025: /TC wird durch /TP überschrieben 1mars.c(905): warning C4805: '!=': unsichere Kombination von Typ 'char' mit Typ

Re: Win32 api with 2.061

2013-01-22 Thread Andrej Mitrovic
On 1/22/13, cal callumena...@gmail.com wrote: I am trying to compile a project using the Win32 api header's (the Dsource ones) with 2.061 and am getting errors for the first time with things like this: Try making these changes:

Re: MS ODBC encoding issue

2013-01-22 Thread Sam Hu
On Thursday, 17 January 2013 at 18:36:16 UTC, Regan Heath wrote: On Mon, 14 Jan 2013 10:02:04 -, Regan Heath re...@netmail.co.nz wrote: Ok, solved the issue I think. Appreciatd all the help and am very excited that it finaly works,WOW! Now I can see (in Visual-D debugger) the Chinese

Re: MS ODBC encoding issue

2013-01-22 Thread Sam Hu
I've tested and the Chinese character issue really fixed! But I have two more issues here. 1.for connect with DSNless string function provided by my original code as below,I can not make it to connect successfully with really database file.Don't now why yours works. bool connect(string

shared std.signals

2013-01-22 Thread Joshua Niehus
Is it possible to create a shared signal class? I would like to create a shared signal class so some other process that knows certain things can come along emit its info to any observer: import std.stdio, std.signals; class Observer { void watch(string msg) { writeln(msg); }

Re: shared std.signals

2013-01-22 Thread Joshua Niehus
On Wednesday, 23 January 2013 at 07:11:59 UTC, Joshua Niehus wrote: Is it possible to create a shared signal class? oh god... dont tell me __gshared ! Think i answered my own question, it got me to the next step. going to have to read through those giant shared threads again