www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - win32 waitnotify library & requirement of dummy var ?

reply Dan <ddaglas gmail.com> writes:
All,

The attached zip file contains a Win32 implementation for Java's
wait()/notify()/notifyAll() functionality for D.

If you examine the source file waitnotify.d, it contains the following
declaration in the WaitNotifyObject class:

public bool dummy = false;

It is an unused variable.  With it in there, the library works fine.  When I
take out the dummy variable, Access Violations occur.  (Try compiling by
issuing "make" and run "main.exe".)

Why is this happening?  Is it a problem with the compiler?  With the public.d
/ privateImpl.d paradigm in use?  Is it an alignment issue?

--Dan
begin 644 waitnotify.zip

M4$L'"``````"`````````%!+`P04`` `"``KL)(U````````````````%```

M+DI-+$E-T76J!`F8ZAG$&Y J:`27YBGX9B87Y1=7%I>DYA8K>.8EZVGR<O%R

M````;6%I;BYDO5513]LP$'ZF4O_#T8

MO1Z,68Q<X0#RXCIC

M!8_%8H%< ^`(8 8Z19B)+!-+*ZO=ND.IK*`#F

M0%("`>RW+/B5Q[CMK:5D&F<9)QU/"R>GT^U.8"BVJCZ$*D/,R5ZY+5$7DL-N


MOW1D)B006Q4[V(W8A_V([>P$!DML2UQF8AL1!,:25#HV>W"C]J89O-]=`S>R


M&J? QPX:( .WJO3C"3R())6I0&$L>**"CJ-K=A>L"RI4ZJY+`W+O";+_:N2[
MYY'/>X+47YBZ+10N:&[>Y69K7*RC%<Z;XR%"^EW8:S)#U4\M5[:96 "-;PLF


M`%!+!PA5T9UDR`(``*P'``!02P,$%``(`` `,9.2-0````````````````\`
M``!C>6-L:6-B87)R:65R+F1]D#U/`S$,AO>3[C^\8RN5WGZ=^! 908Q5FK ]
MBSNG)$Y+A?CO)-<  9`8,L3V\_A-N ZW20<?>CP8R><PFM V78='MB21>AS3

M;INVF3(Q$NS%9O'.A,`4-J7!T]$'152WUB&0<7,U;ZP96)3"WEB">MS/^-T5
M+W,V1X^_R^CQ-(OPT3:`#AP760))T_:Z(:Z*%8Y&.ABEQ1(UT/:[M-P4-(< 

M->.(0)J"Q*+\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P*`JSNO*<OP/,- E<0!3MX/D^7R^N$)=SC]]55
M 29RN=WK#PG-[/H7L'/X/I<7V B+NUS\HN`:2,%=HA3C)KC)'W2"T_`*LH>H

M)U%H'!!\8CWBR7``W*%<MA6LY'%Y/2^GT'JQCE]5B<DHTNO; OT-+/HJ&;8>


M>F")?\T1S K;;0Z9X/0V8]A>LE/.].KJ"]NM'7NB#L8)9&V2:"M4"$\[C?&L


M;X.&YJ';Y)_N+E?83]X6%X)L"DPE\4")3B;ZPS/8.!,V3E&ZXF%MY:OF&W8\

M:&C3Z?/H`_N-X5_<G5O_/$,?_UVOLGLPCF!I;VDBQVQ9Q9`3__E'Z,`JAIIX

M:R88`VQ$59UD(D[]$:LU*AVB+3FAE+`N4I`P9B%YFLG_$2LW[4V(8\ U?]**
M.Z,MVJ\4D9&'!&/I"V*K\7B["7WN2^AS>]'G'D6?^[?H;K\'Y][(.^A]?XS9

MBSLX2L?V X.^"!QT]%\+P9'_-X"Q>0 V(W !03^"TPB^C^`R BP$'((V!-T(



MB_B%'RULHK],+N)GE[YH%3E3!Y_W,K\OZ:2SN)#II"3MF?Y]^AF'"-^G&4?L
MH.Z,`W!`F]'/^*<YD_Y%/+#RKY
MC(<G^;L#FM'?>=#DRQR8V%,V^%_XR9[B*2"-*;!M\+HP`4=Z[RS_M`+&^"Q_

M.6R.K`"[?F8W^)TT\RO-S S6X<1U#JS
M5VDT*2AA-ZAA)NBS5,$R[119QB"Z_MIG2`&9^O#Y4ZX
MR^ZDL_R=`O3]=/&T_Y_F__OG?P!02P<(V-4;'PX2````. ``4$L!`A0`%``(
M`` `*["2-0`````"``````````D`!````````````````````$U%5$$M24Y&
M+_[*``!02P$"%``4`` `"``KL)(U`=72<T<```!'````%```````````````
M```]````345402U)3D8O34%.249%4U0N34902P$"%``4`` `"``SDY(U5=&=

M,9.2-8L `4H9`0``]P$```\`````````````````P ,``&-Y8VQI8V)A<G)I

M`! %``!C>6-L:6-B87)R:65R26UP;"YD4$L!`A0`%``(`` `-).2-:^./YW0
M!0``'!(```<`````````````````20<``'%U975E+F102P$"%``4`` `"``U


M<V5M87!H;W)E26UP;"YD4$L!`A0`%``(`` `-Y.2->X2QC)M`0``<P(```P`


M4$L!`A0`%``(`` `/).2->E;W"FA!P``QA<```<`````````````````DQ4`



MDC78U1L?#A(````Z```.`````````````````%LA``!W86ET;F]T:69Y+FQI

`
end
Dec 18 2006
parent reply catrino <catrino cbs.cnrs.fr> writes:
Thank you for your waitnotify library. I was looking for something like this. I
have implemented something myself but your implementation is better. I believe
these wait(), notify() functionalities should be part of the Object class, which
means to recompile phobos. The problem is that it is not possible to add members
to the Object class. I've tried that and the compiler fails on an assertion on
the
Object size.

For your SIGSEGV problem, I believe that it is due to the public/private
implementation. In your waitnotifyImpl.d you added an int member to the
WaitNotifyObject. It means that the size of a WaitNotifyObject will be the size
of
Object + the size of an int. In your public waitnotify.d, if you don't add a
member the WaitNotifyObject will appear to have the same size of a basic Object
but it is bigger in fact. I believe the hidden int member gets altered by other
objects in memory, the place where it lies looks available. I had similar
problems
when I was playing with phobos (adding members to classes and recompiling).

Another thing that is important when using public/private implementation is to
always keep the methods in the same order. This is because the D compiler stores
the methods in the virtual function table in the order they appear in the source
file. For example if you have a public file like this :
class A {
   void fun();
   void afun();
}
and a private file like this
class A {
   void afun() { ... }
   void fun() { ... }
}
then when you will call A.fun() from a program importing your public d file and
linked with your already compiled private implementation you will have A.afun()
called instead. The same happens when you try to call A.afun(), you call A.fun()
instead.
I had this problem too.

I hope you could read my poor english and that I could help you.

Vincent
Dec 19 2006
parent Dan <ddaglas gmail.com> writes:
== Quote from catrino (catrino cbs.cnrs.fr)'s article
 Thank you for your waitnotify library. I was looking for something like this. I
 have implemented something myself but your implementation is better. I believe
 these wait(), notify() functionalities should be part of the Object class,
which
 means to recompile phobos. The problem is that it is not possible to add
members
 to the Object class. I've tried that and the compiler fails on an assertion on
the
 Object size.
 For your SIGSEGV problem, I believe that it is due to the public/private
 implementation. In your waitnotifyImpl.d you added an int member to the
 WaitNotifyObject. It means that the size of a WaitNotifyObject will be the
size of
 Object + the size of an int. In your public waitnotify.d, if you don't add a
 member the WaitNotifyObject will appear to have the same size of a basic Object
 but it is bigger in fact. I believe the hidden int member gets altered by other
 objects in memory, the place where it lies looks available. I had similar
problems
 when I was playing with phobos (adding members to classes and recompiling).
 Another thing that is important when using public/private implementation is to
 always keep the methods in the same order. This is because the D compiler
stores
 the methods in the virtual function table in the order they appear in the
source
 file. For example if you have a public file like this :
 class A {
    void fun();
    void afun();
 }
 and a private file like this
 class A {
    void afun() { ... }
    void fun() { ... }
 }
 then when you will call A.fun() from a program importing your public d file and
 linked with your already compiled private implementation you will have A.afun()
 called instead. The same happens when you try to call A.afun(), you call
A.fun()
 instead.
 I had this problem too.
 I hope you could read my poor english and that I could help you.
 Vincent
Vincent, I appreciate the advice. I will try a few things, like experimenting with volatile, making sure methods are in the same order, etc. Thanks. Dan
Dec 20 2006