At 17:18 31/05/2007, you wrote: >On 5/31/07, Eduardo Morras <[EMAIL PROTECTED]> wrote: >>At 23:25 30/05/2007, you wrote: >>>Setting and reading individual bytes (u8 in sqlite-speak) are not >>>threadsafe either. Only reading/setting entire entire words >>>are threadsafe on most architectures. >> >>Using a uint32 for store the flags is threadsafe. There are less than 32 >>true/false values and read/set is simple. I see no difference doing >> >>if (uint8==0){ // read/test bit >>uint8=1; // set bit >>whatever more >>} > >Not atomic, so not thread-safe. >You have a race condition waiting to happen. > >>and >> >>if (uint32&&MASK){ // read/test bit >>uint32&&=MASK; // set bit >>whatever >>} > >Also not atomic, so not thread-safe.
I think i have not explained too well. I have wanted to point that if you can modify/set 8 or 9 values atomically/thread-safe you can do it with one 32 bit flag value. ------------------------------------------------------------------------------------------------------------ Usuario de FreeBSD+Xfce, OpenOffice y muchos mas OSS. Microsoft declara que el OSS viola 235 patentes. Por favor, DENUNCIAME. ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------