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?
begin 644 critical.d
M<')I=F%T92!I;7!O<G0 8V]R92YS>7,N=VEN9&]W<RYW:6YD;W=S(#H 16YT






M7W-E8W1I;VXN8W,I.R!D8W-?;&ES="`]("9C<FET:6-A;%]S96-T:6]N.R!]


M7VQI<W0N8W,I.PT*"0D)9&-S7VQI<W0 /2!D8W-?;&ES="YN97AT.PT*"0E]






M:6X =&AE(&UE86YT:6UE+"!A;F]T:&5R('1H<F5A9"!D:61N)W0 <V5T(&ET

M="`](&1C<SL-" D)"0E);FET:6%L:7IE0W)I=&EC86Q396-T:6]N*"9D8W,N


M:6]N*"9D8W,N8W,I.PT*"7T-" T*"79O:60 7V1?8W)I=&EC86QE>&ET*$1?


`
end
begin 644 monitor.d
M<')I=F%T92!I;7!O<G0 8V]R92YS>7,N=VEN9&]W<RYW:6YD;W=S(#H 16YT



M<W1D;&EB.PT*<')I=F%T92!I;7!O<G0 <G0N;&EF971I;64 .B!!<G)A>3L-
M" T*+R\ 5&AI<R!I<R!W:&%T('1H92!M;VYI=&]R(')E9F5R96YC92!I;B!/

M("!I;7!L.R`O+R!F;W( =7-E<BUL979E;"!M;VYI=&]R<PT*("` ($%R<F%Y
M("!D979T.R`O+R!F;W( :6YT97)N86P ;6]N:71O<G,-"B` ("!S:7IE7W0 


M)BAC87-T*$UO;FET;W(J*6 N7U]M;VYI=&]R*2YM;VX[('T-" T*+RH /3T]
M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/2!7:6XS,B`]/3T]/3T]/3T]



M;&EZ94-R:71I8V%L4V5C=&EO;B F7VUO;FET;W)?8W)I='-E8RD[('T-" EV


M;FET;W)?8W)E871E*$]B:F5C="!H*0T*"7L-" D ("` +RH-" D)*B!.3U1%
M.B!!<W-U;64 =&AI<R!I<R!O;FQY(&-A;&QE9"!W:&5N(& N7U]M;VYI=&]R

M96%S92!N;W1E('1H870 86YO=&AE<B!T:')E860 ;6%Y(&-A;&P =&AI<R!F
M=6YC=&EO; T*"0DJ(&%T('1H92!S86UE('1I;64L('-O('=E(&-A;B!N;W0 
M87-S97)T('1H:7, :&5R92X ($EN<W1E860L('1R>2!A;F0-" D)*B!C<F5A
M=&4 82!L;V-K+"!A;F0 :68 ;VYE(&%L<F5A9'D 97AI<W1S('1H96X 9F]R

M:71O<E]C<F5A=&4H)7`I7&XB+"!H*3L-" D ("` 87-S97)T*& I.PT*"2` 

M:6]N*"9?;6]N:71O<E]C<FET<V5C*3L-" D ("` :68 *"%H+E]?;6]N:71O
M<BD-" D ("` >PT*"0D)8W, /2!C87-T*$UO;FET;W(J*6-A;&QO8RA-;VYI

M94-R:71I8V%L4V5C=&EO;B F8W,N;6]N*3L-" D)"6 N7U]M;VYI=&]R(#T 

M"2` ("!,96%V94-R:71I8V%L4V5C=&EO;B F7VUO;FET;W)?8W)I='-E8RD[



M9B B*U]D7VUO;FET;W)?9&5S=')O>2 E<"E<;B(L(& I.PT*"2` ("!A<W-E
M<G0H:"`F)B!H+E]?;6]N:71O<B`F)B`A*&-A<W0H36]N:71O<BHI:"Y?7VUO


M;VYI=&]R(#T ;G5L;#L-" D ("` +R]P<FEN=&8H(BU?9%]M;VYI=&]R7V1E








M("` (&%S<V5R="AH("8F(& N7U]M;VYI=&]R("8F("$H8V%S="A-;VYI=&]R



`
end
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






 M7W-E8W1I;VXN8W,I.R!D8W-?;&ES="`]("9C<FET:6-A;%]S96-T:6]N.R!]


 M7VQI<W0N8W,I.PT*"0D)9&-S7VQI<W0 /2!D8W-?;&ES="YN97AT.PT*"0E]






 M:6X =&AE(&UE86YT:6UE+"!A;F]T:&5R('1H<F5A9"!D:61N)W0 <V5T(&ET

 M="`](&1C<SL-" D)"0E);FET:6%L:7IE0W)I=&EC86Q396-T:6]N*"9D8W,N


 M:6]N*"9D8W,N8W,I.PT*"7T-" T*"79O:60 7V1?8W)I=&EC86QE>&ET*$1?


 `
 end
 begin 644 monitor.d
 M<')I=F%T92!I;7!O<G0 8V]R92YS>7,N=VEN9&]W<RYW:6YD;W=S(#H 16YT



 M<W1D;&EB.PT*<')I=F%T92!I;7!O<G0 <G0N;&EF971I;64 .B!!<G)A>3L-
 M" T*+R\ 5&AI<R!I<R!W:&%T('1H92!M;VYI=&]R(')E9F5R96YC92!I;B!/

 M("!I;7!L.R`O+R!F;W( =7-E<BUL979E;"!M;VYI=&]R<PT*("` ($%R<F%Y
 M("!D979T.R`O+R!F;W( :6YT97)N86P ;6]N:71O<G,-"B` ("!S:7IE7W0 


 M)BAC87-T*$UO;FET;W(J*6 N7U]M;VYI=&]R*2YM;VX[('T-" T*+RH /3T]
 M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/2!7:6XS,B`]/3T]/3T]/3T]



 M;&EZ94-R:71I8V%L4V5C=&EO;B F7VUO;FET;W)?8W)I='-E8RD[('T-" EV


 M;FET;W)?8W)E871E*$]B:F5C="!H*0T*"7L-" D ("` +RH-" D)*B!.3U1%
 M.B!!<W-U;64 =&AI<R!I<R!O;FQY(&-A;&QE9"!W:&5N(& N7U]M;VYI=&]R

 M96%S92!N;W1E('1H870 86YO=&AE<B!T:')E860 ;6%Y(&-A;&P =&AI<R!F
 M=6YC=&EO; T*"0DJ(&%T('1H92!S86UE('1I;64L('-O('=E(&-A;B!N;W0 
 M87-S97)T('1H:7, :&5R92X ($EN<W1E860L('1R>2!A;F0-" D)*B!C<F5A
 M=&4 82!L;V-K+"!A;F0 :68 ;VYE(&%L<F5A9'D 97AI<W1S('1H96X 9F]R

 M:71O<E]C<F5A=&4H)7`I7&XB+"!H*3L-" D ("` 87-S97)T*& I.PT*"2` 

 M:6]N*"9?;6]N:71O<E]C<FET<V5C*3L-" D ("` :68 *"%H+E]?;6]N:71O
 M<BD-" D ("` >PT*"0D)8W, /2!C87-T*$UO;FET;W(J*6-A;&QO8RA-;VYI

 M94-R:71I8V%L4V5C=&EO;B F8W,N;6]N*3L-" D)"6 N7U]M;VYI=&]R(#T 

 M"2` ("!,96%V94-R:71I8V%L4V5C=&EO;B F7VUO;FET;W)?8W)I='-E8RD[



 M9B B*U]D7VUO;FET;W)?9&5S=')O>2 E<"E<;B(L(& I.PT*"2` ("!A<W-E
 M<G0H:"`F)B!H+E]?;6]N:71O<B`F)B`A*&-A<W0H36]N:71O<BHI:"Y?7VUO


 M;VYI=&]R(#T ;G5L;#L-" D ("` +R]P<FEN=&8H(BU?9%]M;VYI=&]R7V1E








 M("` (&%S<V5R="AH("8F(& N7U]M;VYI=&]R("8F("$H8V%S="A-;VYI=&]R



 `
 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 reply 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
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
aren't written in D?
 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.
Cool, I added the attachments!
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
aren't written in D?
 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