Changeset 1109


Ignore:
Timestamp:
Dec 10, 2011, 4:53:21 PM (8 years ago)
Author:
sam
Message:

build: for now, assume anything with <pthread.h> uses the pthread API.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r1093 r1109  
    5555  [  --enable-experimental   experimental build (default no)])
    5656
    57 AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h)
     57AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h fastmath.h pthread.h)
    5858
    5959if test "${enable_debug}" = "yes"; then
  • trunk/src/thread/threadbase.h

    r1105 r1109  
    1717#define __LOL_THREADBASE_H__
    1818
    19 #if defined __linux__ || defined __native_client__
     19#if defined HAVE_PTHREAD_H
    2020#   include <pthread.h>
    2121#elif defined _WIN32
     
    3333    MutexBase()
    3434    {
    35 #if defined __linux__ || defined __native_client__
     35#if defined HAVE_PTHREAD_H
    3636        pthread_mutex_init(&m_mutex, NULL);
    3737#elif defined _WIN32
     
    4242    ~MutexBase()
    4343    {
    44 #if defined __linux__ || defined __native_client__
     44#if defined HAVE_PTHREAD_H
    4545        pthread_mutex_destroy(&m_mutex);
    4646#elif defined _WIN32
     
    5151    void Lock()
    5252    {
    53 #if defined __linux__ || defined __native_client__
     53#if defined HAVE_PTHREAD_H
    5454        pthread_mutex_lock(&m_mutex);
    5555#elif defined _WIN32
     
    6060    void Unlock()
    6161    {
    62 #if defined __linux__ || defined __native_client__
     62#if defined HAVE_PTHREAD_H
    6363        pthread_mutex_unlock(&m_mutex);
    6464#elif defined _WIN32
     
    6868
    6969private:
    70 #if defined __linux__ || defined __native_client__
     70#if defined HAVE_PTHREAD_H
    7171    pthread_mutex_t m_mutex;
    7272#elif defined _WIN32
     
    8181    {
    8282        m_start = m_count = 0;
    83 #if defined __linux__ || defined __native_client__
     83#if defined HAVE_PTHREAD_H
    8484        m_poppers = m_pushers = 0;
    8585        pthread_mutex_init(&m_mutex, NULL);
     
    9595    ~QueueBase()
    9696    {
    97 #if defined __linux__ || defined __native_client__
     97#if defined HAVE_PTHREAD_H
    9898        pthread_cond_destroy(&m_empty_cond);
    9999        pthread_cond_destroy(&m_full_cond);
     
    108108    void Push(int value)
    109109    {
    110 #if defined __linux__ || defined __native_client__
     110#if defined HAVE_PTHREAD_H
    111111        pthread_mutex_lock(&m_mutex);
    112112        /* If queue is full, wait on the "full" cond var. */
     
    124124        m_count++;
    125125
    126 #if defined __linux__ || defined __native_client__
     126#if defined HAVE_PTHREAD_H
    127127        /* If there were poppers waiting, signal the "empty" cond var. */
    128128        if (m_poppers)
     
    137137    int Pop()
    138138    {
    139 #if defined __linux__ || defined __native_client__
     139#if defined HAVE_PTHREAD_H
    140140        pthread_mutex_lock(&m_mutex);
    141141        /* Wait until there is something in the queue. Be careful, we
     
    156156        m_count--;
    157157
    158 #if defined __linux__ || defined __native_client__
     158#if defined HAVE_PTHREAD_H
    159159        /* If there were pushers waiting, signal the "full" cond var. */
    160160        if (m_pushers)
     
    173173    int m_values[CAPACITY];
    174174    size_t m_start, m_count;
    175 #if defined __linux__ || defined __native_client__
     175#if defined HAVE_PTHREAD_H
    176176    size_t m_poppers, m_pushers;
    177177    pthread_mutex_t m_mutex;
     
    188188    ThreadBase(void *(*fn)(void *), void *data)
    189189    {
    190 #if defined __linux__ || defined __native_client__
     190#if defined HAVE_PTHREAD_H
    191191        /* Set the joinable attribute for systems who don't play nice */
    192192        pthread_attr_t attr;
     
    202202    virtual ~ThreadBase()
    203203    {
    204 #if defined __linux__ || defined __native_client__
     204#if defined HAVE_PTHREAD_H
    205205        pthread_join(m_thread, NULL);
    206206#elif defined _WIN32
     
    210210
    211211private:
    212 #if defined __linux__ || defined __native_client__
     212#if defined HAVE_PTHREAD_H
    213213    pthread_t m_thread;
    214214#elif defined _WIN32
Note: See TracChangeset for help on using the changeset viewer.