Talk:Atomic updates: Difference between revisions

No edit summary
 
(One intermediate revision by the same user not shown)
Line 18:
== And in a language that does not support multithreading ? ==
The question is in the title. While preserving an invariant still makes sense, the task needs some clarification: in that case, it doesn't illustrate anything about atomic updates, since there cannot be multiple updates at the same time anyway. [[User:Capra Hircus|Capra Hircus]] 19:53, 1 September 2012 (UTC)
 
== Go code ==
For people that want to actually try to run the code, I think the Go entries should explain that to compile the Go entries you need some changes:
<lang go>import (
"fmt"
"math/rand"
"time"
"sync"
"runtime"
)
...
func main() {
// Create a concrete object implementing the bucketList
interface.
bl := newRwList(10, originalTotal, nUpdaters)</lang>
 
And for the third:
 
<lang go>import (
"fmt"
"math/rand"
"time"
"sync"
"runtime"
"sync/atomic"
)
...
func main() {
// Create a concrete object implementing the bucketList
interface.
bl := newLfList(10, originalTotal, nUpdaters)</lang>
 
The first Go solution compiles as it is, but I don't see any printing output.