Thread join behaviour

Artur Skawina art.08.09 at gmail.com
Sun Apr 15 07:04:02 PDT 2012


On 04/15/12 15:55, Russel Winder wrote:
> 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:

works here, when written as

   auto threads = array(map ! ( function ( int a ) {
       void delegate ( ) f ( ) {
         return delegate ( ) { writeln ( a ) ; } ; 
       }
       return new Thread ( f )  ;
     } ) ( iota ( 10 ) )) ;

(my old GDC needs the explicit "function", no idea if newer
frontends still require that)

artur


More information about the Digitalmars-d-learn mailing list