Thread join behaviour

Russel Winder russel at winder.org.uk
Sun Apr 15 06:55:21 PDT 2012


On Sat, 2012-04-14 at 23:25 +0200, Artur Skawina wrote:
[...]
> 
> 'threads' is a (lazy) range; 
> 
>            auto threads = array(map ! ( ( int a ) {
>                void delegate ( ) f ( ) {
>                  return delegate ( ) { writeln ( a ) ; } ; 
>                }
>                return new Thread ( f )  ;
>              } ) ( iota ( 10 ) )) ;
> 

Sadly this is not going to work:


/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/traits.d(1482): Error: void does not have a default initializer
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/traits.d(1493): Error: template instance std.traits.hasIndirections!(Thread).Impl!(void[168LU]) error instantiating
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(143):        instantiated from here: hasIndirections!(Thread)
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(143): Error: template instance std.traits.hasIndirections!(Thread) error instantiating
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(243): Error: template instance std.array.blockAttribute!(Thread) error instantiating
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(194):        instantiated from here: arrayAllocImpl!(false,Thread[],uint)
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(42):        instantiated from here: uninitializedArray!(Thread[],uint)
./initializingWithAMap.d(9):        instantiated from here: array!(Result)
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(194): Error: template instance std.array.arrayAllocImpl!(false,Thread[],uint) error instantiating
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(42):        instantiated from here: uninitializedArray!(Thread[],uint)
./initializingWithAMap.d(9):        instantiated from here: array!(Result)
/home/users/russel/lib.Linux.x86_64/DMD2/bin64/../../src/phobos/std/array.d(42): Error: template instance std.array.uninitializedArray!(Thread[],uint) error instantiating
./initializingWithAMap.d(9):        instantiated from here: array!(Result)
./initializingWithAMap.d(9): Error: template instance std.array.array!(Result) error instantiating


-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120415/08c02fbb/attachment.pgp>


More information about the Digitalmars-d-learn mailing list