Is x+=1 threadsafe? No it isn't...A question that popped up on comp.lang.python the other day:
I still can not believe that +=1 is not a thread safe operation. Any clue?
Yes, indeed, the statement
x+=1
is not thread-safe (or atomic, as you wish). Why the hell is that?
Well, the statement:
x+=1
is equivalent to:
x = x.__iadd__(1)
i.e. a function call followed by an assignment. The function call may execute atomicly, but the combination of this with the second operation (rebinding of the new integer object to x) isn't atomic.
So if we want to use simple counters across threads, they also need to be synchronised by proper lock objects.
• Wrote irmen at 01:25 | read 0× | 0 Comments
Dolfijnen vinden wiel uitAir vortex: http://www.dumpert.nl/mediabase/39351/c7476b94/dolfijnen_vinden_wiel_uit.html

Upgraden moinmoin wikiUPDATEN VAN MOINMOIN WIKI
Omdat ik elke keer vergeet hoe MoinMoin geupgrade moet worden die ik hier als wiki software gebruik, heb ik het maar eens uitgetypt:
Known bug: in de default 1.6.0 versie zit een bug die Moin doet crashen als de browser geen language header opstuurt. Zie hier. Dus de daar gelinkte patch heb ik toegepast. Het wachten is op 1.6.1...
• Wrote irmen at 15:57 (edited 1×, last on 21 Jan 2008) | read 37× | 2 Comments
The Orange Box: ik duik onder, tot over een paar weken![[[image: pc_halflife_2_orange_box.jpg]]](/frog/files/irmen/hl2/pc_halflife_2_orange_box.jpg)
Gister in de bus gevallen. Ik ben voorlopig niet bereikbaar
![[[image: hl2ep2_1.jpg]]](/frog/files/irmen/hl2/hl2ep2_1.jpg)
<Guildless>![]()
<Guildless>
Due to various reasons we had to disband our World of Warcraft raiding guild Running Wild. It's hard to see something go down that you've helped to create, and have put a lot of effort in. I've been officer since the day we formed the guild early this year, and it was a real difficult task to tell in guildchat about the decision the officers made a few days earlier:
Sadly, in the end it became impossible to pursue the guild's goals any longer.
I had a terrific time with my fellow officers, friends, and guildmates, and we accomplished quite a lot. But it has also shown me that being an officer and raid leader in a raid guild brings a bag of shit as well. I can't to do this again.
Some may criticize me for being too addicted to this game called World of Warcraft, but I can just say I had this dedication and drive to make it worthwile for myself and my fellow guildmates. I spent a lot of time on my officer duties and on playing the game. Call it a sacrifice, call me a nerd who doesn't go outside, I don't care. I know better than that.
Thank you all that made the time I devoted to Running Wild worthwhile. You know who you are.
• Wrote irmen at 00:30 | read 47× | 1 Comments
Schimmenspel![[[image: schimmenspel.jpg]]](/frog/files/irmen/plaatjes/schimmenspel.jpg)
Schimmenspel. Toch wel een van de beste die ik ooit gezien heb! 
Lolcats go clubbinglolcats zijn erg melig, maar deze lolcat is helemaal de bom! DJ spin that shit!
![[[image: catdj.png]]](/frog/files/irmen/plaatjes/catdj.png)
(in plaats van een plaatje is dit een heel grappig filmpje
)
Roflmao. Tu duu de duu duu.De muppets zijn geweldig natuurlijk, maar het volgende filmpje bevat deze keer geen muppets maar 3 world of warcraft figuurtjes. Het is er niet minder grappig om: Roflmao !
• Wrote irmen at 10:38 | read 41× | 0 Comments
icon is the article's permalink.