On 6/24/11 4:17 AM, MacArthur, Ian (SELEX GALILEO, UK) wrote:
> 
>> Shouldn't be hard. In Windows you can use 
>> EnterCriticalSection()/LeaveCriticalSection()
>> to manage the mutex lock.
> 
> And in practice, if you have one writer thread and one reader thread,
> you can probably just use volatile ints to signal between them, rather
> than using a mutex - this has the advantages of being cheaper and also
> more portable (since it doesn't require any OS specific coding.)

        Hmm, I wouldn't want to gamble on that, as I'm pretty sure
        volatile only protects you from compiler optimization,
        and nothing else.

        Also, even if the operations *are* atomic, don't you end
        up with a potential race condition?

        I'm pretty sure a mutex is the only way to prevent a race..
        what does your code look like to do mutex-like sync without
        the OS calls?

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to