[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvswitch-dev
Subject:    [ovs-dev] [threads 05/11] ovs-thread: Add support for various thread-related assertions.
From:       blp () nicira ! com (Ben Pfaff)
Date:       2013-06-28 23:01:48
Message-ID: 20130628230148.GD32128 () nicira ! com
[Download RAW message or body]

On Fri, Jun 28, 2013 at 03:34:26PM -0700, Ethan Jackson wrote:
> Should the multithreaded bool be atomic?  I doubt it matters, but
> perhaps if pthread_create()'s implementation is odd, we could have a
> problem.
> 
> Acked-by: Ethan Jackson <ethan at nicira.com>

Thanks for the review.

I don't think it's necessary for 'multithreaded' to be atomic, because
POSIX says that pthread_create() is a memory synchronization point:

    4.11 Memory Synchronization

    Applications shall ensure that access to any memory location by
    more than one thread of control (threads or processes) is
    restricted such that no thread of control can read or modify a
    memory location while another thread of control may be modifying
    it. Such access is restricted using functions that synchronize
    thread execution and also synchronize memory with respect to other
    threads. The following functions synchronize memory with respect
    to other threads:

    fork()
    pthread_barrier_wait()
    pthread_cond_broadcast()
    pthread_cond_signal()
    pthread_cond_timedwait()
    pthread_cond_wait()
    pthread_create()
    pthread_join()
    pthread_mutex_lock()
    pthread_mutex_timedlock()
    pthread_mutex_trylock()
    pthread_mutex_unlock()
    pthread_spin_lock()
    pthread_spin_trylock()
    pthread_spin_unlock()
    pthread_rwlock_rdlock()
    pthread_rwlock_timedrdlock()
    pthread_rwlock_timedwrlock()
    pthread_rwlock_tryrdlock()
    pthread_rwlock_trywrlock()
    pthread_rwlock_unlock()
    pthread_rwlock_wrlock()
    sem_post()
    sem_timedwait()
    sem_trywait()
    sem_wait()
    semctl()
    semop()
    wait()
    waitpid()

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic