Comments (3)
The following patch fixes the issue:
--- a/lib/pure/actors.nim Wed Nov 30 19:52:09 2011 +0100 +++ b/lib/pure/actors.nim Sat Dec 03 17:24:02 2011 +0100 @@ -129,24 +129,24 @@ template schedule = # extremely simple scheduler: We always try the first thread first, so that # it remains 'hot' ;-). Round-robin hurts for keeping threads hot. - for i in 0..high(a.actors): - if a.actors[i].i.ready: - a.actors[i].i.send(t) + for i in 0..high(p.actors): + if p.actors[i].i.ready: + p.actors[i].i.send(t) return # no thread ready :-( --> send message to the thread which has the least # messages pending: var minIdx = 0 var minVal = high(int) - for i in 0..high(a.actors): - var curr = a.actors[i].i.peek + for i in 0..high(p.actors): + var curr = p.actors[i].i.peek if curr == 0: # ok, is ready now: - a.actors[i].i.send(t) + p.actors[i].i.send(t) return if curr < minVal: minVal = curr minIdx = i - a.actors[minIdx].i.send(t) + p.actors[minIdx].i.send(t) proc spawn*[TIn, TOut](p: var TActorPool[TIn, TOut], input: TIn, action: proc (input: TIn): TOut {.thread.}
from nim.
I chose my examples poorly :( The patch works whatever the name of the pool (the fact that you need to use "p" in the "schedule" template is due to the parameter name in spawn, not the name in my example)
from nim.
Thanks.
from nim.
Related Issues (20)
- `joinPath` sometimes has extra `.` in the beginning of the path HOT 3
- `hasCustomPragma` does not work on generic types HOT 2
- Rasing an exception leaks memeory in `orc` HOT 1
- Seq IndexDefect leaks memeory in `arc` and `orc`
- https://learnxinyminutes.com/docs/nim/ error in the learning documentation code HOT 3
- `noinit` can cause arc to crash with ref objects HOT 2
- hello world Mummy web server crashes on devel HOT 17
- Sigsegv on std/tasks destructor HOT 2
- `=destroy` for non-var failed to compile when `nim doc` HOT 4
- regression from 2.0.4 to 2.0.6 cannot instantiate: 'SomeInteger' in return type HOT 1
- Deadloop in Windows, `os.sleep(-1)` HOT 5
- Deadloop in Windows, `os.sleep(-1)` HOT 1
- Inefficient codegen for field return HOT 2
- `setLen(0)` allocates memory causing performance regression HOT 3
- Generic sequence of proc type mismatch HOT 3
- `int64/int64` not compile for JS, but for C. HOT 4
- Local variables can be prematurely moved to closure, causing use-after-move HOT 2
- Regression: ambiguous identifier
- Regression from 1.6 to 2.0 using static parameter in return type with function taking typeclass HOT 3
- Can't create empty openArray with int8 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nim.