Changeset 387

Show
Ignore:
Timestamp:
07/12/08 19:36:11 (3 months ago)
Author:
FeepingCreature
Message:
  • Stupid bug. Sorry.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tools/tools/threadpool.d

    r386 r387  
    6161  void mt_foreach(T, C)(T iterable, C callable) { 
    6262    int left; auto sync = new Object; 
    63     static if (is(typeof({ foreach (i, entry; array) callable(i, entry); }))) { 
    64       foreach (i, entry; array) { 
     63    static if (is(typeof({ foreach (i, entry; iterable) callable(i, entry); }))) { 
     64      foreach (i, entry; iterable) { 
    6565        synchronized(sync) left ++; 
    6666        addTask(stuple(i, entry) /apply/ (typeof(i) i, typeof(entry) entry) { 
     
    6969        }); 
    7070      } 
    71     } else static if (is(typeof({ foreach (entry; array) callable(entry); }))) { 
    72       foreach (entry; array) { 
     71    } else static if (is(typeof({ foreach (entry; iterable) callable(entry); }))) { 
     72      foreach (entry; iterable) { 
    7373        synchronized(sync) left ++; 
    7474        addTask(entry /apply/ (typeof(entry) entry) { 
     
    7777        }); 
    7878      } 
    79     } 
     79    } else static assert(false, "Cannot seem to iterate over "~T.stringof~", calling "~C.stringof~"!"); 
    8080    while (left) if (idle()) slowyield(); 
    8181  }