[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2018-10-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4957

Mathias LANG  changed:

   What|Removed |Added

 CC||pro.mathias.l...@gmail.com

--- Comment #5 from Mathias LANG  ---
New attempt: https://github.com/dlang/phobos/pull/6738

--


[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2017-01-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4957

Paolo Invernizzi  changed:

   What|Removed |Added

 CC||paolo.inverni...@gmail.com

--


[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2016-01-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4957

ratchet freak  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #4 from ratchet freak  ---
Pull request: https://github.com/D-Programming-Language/phobos/pull/3941

--


[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2012-07-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4957


Johan Hernandez thepumpkin1...@gmail.com changed:

   What|Removed |Added

 CC||thepumpkin1...@gmail.com


--- Comment #3 from Johan Hernandez thepumpkin1...@gmail.com 2012-07-14 
03:06:04 PDT ---
I ran into this issue too. We need a fix :(

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


[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2011-05-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4957


Sean Kelly s...@invisibleduck.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||s...@invisibleduck.org


--- Comment #2 from Sean Kelly s...@invisibleduck.org 2011-05-16 11:23:18 PDT 
---
Curses!  Seems I'll have to apply 'shared' to private members of Tid.

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


[Issue 4957] std.concurrency does not allow to pass Tid in struct fields

2011-05-12 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4957


ratchet freak ratchet.fr...@gmail.com changed:

   What|Removed |Added

 CC||ratchet.fr...@gmail.com


--- Comment #1 from ratchet freak ratchet.fr...@gmail.com 2011-05-12 15:28:20 
PDT ---
I've found how it comes:

std.concurrency defines the following testing template for sending parameters
along

//line 49
template hasLocalAliasing(T...)
{
static if( !T.length )
enum hasLocalAliasing = false;
else
enum hasLocalAliasing = (std.traits.hasLocalAliasing!(T[0]) 
!is(T[0] == Tid)) ||
std.concurrency.hasLocalAliasing!(T[1 ..
$]);
}

which handles Tid as a special case which doesn't happen when it's not
top-level

Tid itself is of the form:

//lines 272
struct Tid
{
void send(T...)( T vals )
{
static assert( !hasLocalAliasing!(T),
   Aliases to mutable thread-local data not allowed. );
_send( this, vals );
}


private:
this( MessageBox m )
{
mbox = m;
}


MessageBox  mbox;
}

MessageBox here does not pass the test of !std.traits.hasLocalAliasing (it's a
class object)

quick fix: make mbox in Tid shared and cast accesses to it to thread local this
allows Tid to pass the !std.traits.hasLocalAliasing test *as one would expect
from it*

struct Tid
{
void send(T...)( T vals )
{
static assert( !hasLocalAliasing!(T),
   Aliases to mutable thread-local data not allowed. );
_send( this, vals );
}


private:
this( MessageBox m )
{
mbox = cast(shared)m;
}


shared MessageBox  mbox;
}

//lines 419
private void _send(T...)( MsgType type, Tid tid, T vals )
{
(cast(MessageBox)tid.mbox).put( Message( type, vals ) );
}

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