[Issue 9763] @contended and @contended("groupName")

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 20 11:54:01 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9763



--- Comment #1 from bearophile_hugs at eml.cc 2013-03-20 11:53:59 PDT ---
A current workaround is to use align (with a value, because of Issue 9766 ):


align(128) struct Test3 {
    int field1;
    int field2;
}
pragma(msg, "Test3:");
pragma(msg, Test3.field1.offsetof);
pragma(msg, Test3.field2.offsetof);
pragma(msg, "Total size:");
pragma(msg, Test3.sizeof);
pragma(msg, "");


The print shows there is trailing padding (no leading padding):

Test3:
0u
4u
Total size:
128u


Adding align(128) on some fields of struct/object allows to introduce
intermediate padding, but it's tricky to get all the padding right. But
@contended adapts automatically the padding needed on different CPUs and makes
the creation of spaces and groups simpler.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list