[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnubg] Multithreaded rollouts
From: |
Jonathan Kinsey |
Subject: |
Re: [Bug-gnubg] Multithreaded rollouts |
Date: |
Fri, 09 Feb 2007 12:21:00 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.0 |
Jonathan Kinsey wrote:
> Christian Anthon wrote:
>> Hi Jon,
>>
>> the code compiles on linux and appears to be working using the
>> g_atomic equivalents. But I'm on a single cpu/core computer so I can't
>> really test it. A couple of comments though: I thought that the
>> interlock functions was equivalent to a++ not ++a, but perhaps I'm
>> just tired right now, and you need to include multithread.h
>> unconditionally in rollout.c.
>
> The thread safe increment can be either way around, what's essential is
> that the operation is atomic, i.e. if two threads call the function at
> the same time they should get different values. I'll write a simple
> test to check if it's working (with glib) here.
I think I was mistaken - the GLib atomic functions do work. The problem
I was getting was caused by me not calling g_thread_init() in the test.
Hopefully I'll remove the pthread TLS code at the weekend and then I can
try the glib code on windows.
I need to check in the glib versions of MT_SafeInc/Add, then the code
may well work on linux.
Jon
signature.asc
Description: OpenPGP digital signature