www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - monitor.d and critical.d?

reply %u <wfunction hotmail.com> writes:
Hi,

I was wondering, is there any particular reason why critical.c and monitor.c
aren't written in D?

I've attached the D versions... the only other changes needed would be to
change win32.mak:
1. Change all instances of critical.c and monitor.c to critical.d and monitor.d
2. Add
    src\rt\critical.d \
    src\rt\monitor.d \
  below the
    SRCS= \
  category.
3. Remove critical.obj and monitor.obj from the OBJS= and OBJS_TO_DELETE=
sections.
4. Remove the their ASM targets from the bottom of the makefile  (they're
around line 755).

Does this sound useful? Or was there a particular reason this wasn't done in D?
Jan 30 2011
next sibling parent reply Brad Roberts <braddr puremagic.com> writes:
Please move this to bugzilla and loose the uuencoding.

On 1/30/2011 1:54 AM, %u wrote:
 Hi,
 
 I was wondering, is there any particular reason why critical.c and monitor.c
 aren't written in D?
 
 I've attached the D versions... the only other changes needed would be to
 change win32.mak:
 1. Change all instances of critical.c and monitor.c to critical.d and monitor.d
 2. Add
     src\rt\critical.d \
     src\rt\monitor.d \
   below the
     SRCS= \
   category.
 3. Remove critical.obj and monitor.obj from the OBJS= and OBJS_TO_DELETE=
 sections.
 4. Remove the their ASM targets from the bottom of the makefile  (they're
 around line 755).
 
 Does this sound useful? Or was there a particular reason this wasn't done in D?
 begin 644 critical.d
 M<')I=F%T92!I;7!O<G0 8V]R92YS>7,N=VEN9&]W<RYW:6YD;W=S(#H 16YT
 M97)#<FET:6-A;%-E8W1I;VXL($QE879E0W)I=&EC86Q396-T:6]N+"!$96QE
 M=&5#<FET:6-A;%-E8W1I;VXL($EN:71I86QI>F5#<FET:6-A;%-E8W1I;VXL
 M($-2251)0T%,7U-%0U1)3TX[#0H-"F5X=&5R;B`H0RD-"GL-" ES=')U8W0 
 M1%]#4DE424-!3%]314-424].('L 1%]#4DE424-!3%]314-424].("IN97AT
 M.R!#4DE424-!3%]314-424].(&-S.R!]#0H)=F]I9"!?4U1)7V-R:71I8V%L
 M7VEN:70H*2![($EN:71I86QI>F5#<FET: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($QE879E0W)I=&EC86Q396-T
 M:6]N*$U/3E!44BAH*2D[#0H)("` ("\O<')I;G1F*"(M7V1?;6]N:71O<E]R
 996QE87-E*"5P*5QN(BP :"D[#0H)?0T*?0``
 `
 end

Jan 30 2011
parent %u <wfunction hotmail.com> writes:
Oh shoot, I had no idea it would turn out like that, sorry. (It didn't do that
on
the site so I really didn't expect it.) Thanks for letting me know.
Jan 30 2011
prev sibling parent reply Don <nospam nospam.com> writes:
%u wrote:
 Hi,
 
 I was wondering, is there any particular reason why critical.c and monitor.c
 aren't written in D?
 
 I've attached the D versions... 

Please add as a patch to bug 4332.
Jan 31 2011
next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 1/31/11 10:11 PM, Don wrote:
 %u wrote:
 Hi,

 I was wondering, is there any particular reason why critical.c and
 monitor.c
 aren't written in D?

 I've attached the D versions...

Please add as a patch to bug 4332.

Instead of patches we could use git's pull requests. I don't know how to make one, but David Nadlinger made one for me (see http://d.puremagic.com/issues/show_bug.cgi?id=5506) and it looks great! You get to see the changes introduced in a browser before introducing them with a simple command. David or other git experts, would you put together a sort of a guide for creating pull requests? Andrei
Jan 31 2011
prev sibling next sibling parent "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
On Mon, 31 Jan 2011 22:30:25 -0600, Andrei Alexandrescu wrote:

 David or other git experts, would you put together a sort of a guide for
 creating pull requests?

Other git experts have already done it for us. :) http://help.github.com/pull-requests/ -Lars
Jan 31 2011
prev sibling parent reply %u <wfunction hotmail.com> writes:
 Hi,
 I was wondering, is there any particular reason why critical.c and monitor.c


 I've attached the D versions...


 Please add as a patch to bug 4332.

Cool, I added the attachments! (I have no idea how to use git, or if I have the upload permissions (probably not), so I just uploaded the patches to the bug report.)
Feb 01 2011
next sibling parent %u <wfunction hotmail.com> writes:
 Please add as a patch to bug 4332.


On a second thought, this is a bit trickier than I'd thought, since it's not working without additional modifications that I at first thought were unnecessary. Did the C version run any sort of "static constructors" during the loading of the runtime on Windows? For some reason, when I replace the C version with the D version, I am forced to remove the version statement from here: void _d_criticalInit() { version (Posix) { _STI_monitor_staticctor(); _STI_critical_init(); } } in order to run the static constructors, even though it doesn't seem like the C code would've been any different in this regard. Does anyone know why this is needed?
Feb 01 2011
prev sibling parent Don <nospam nospam.com> writes:
%u wrote:
 Hi,
 I was wondering, is there any particular reason why critical.c and monitor.c


 I've attached the D versions...


 Please add as a patch to bug 4332.

Cool, I added the attachments! (I have no idea how to use git, or if I have the upload permissions (probably not), so I just uploaded the patches to the bug report.)

Yeah, that's fine. Getting started with git is non-trivial, especially on Windows (git for Windows seems to be about on the same level of maturity as D2; I've found a dozen bugs in a few days of use).
Feb 02 2011