DBD-cubrid

 view release on metacpan or  search on metacpan

cci-src/config/ltmain.sh  view on Meta::CPAN

      # Only append if the libtool object file exists.
      test -z "$run" && cat >> ${libobj}T <<EOF
# Name of the non-PIC object.
non_pic_object=none

EOF
    fi

    $run $mv "${libobj}T" "${libobj}"

    # Unlock the critical section if it was locked
    if test "$need_locks" != no; then
      $run $rm "$lockfile"
    fi

    exit $EXIT_SUCCESS
    ;;

  # libtool link mode
  link | relink)
    modename="$modename: link"

cci-src/external/libregex38a/ltmain.sh  view on Meta::CPAN

      # Only append if the libtool object file exists.
      test -z "$run" && cat >> ${libobj}T <<EOF
# Name of the non-PIC object.
non_pic_object=none

EOF
    fi

    $run $mv "${libobj}T" "${libobj}"

    # Unlock the critical section if it was locked
    if test "$need_locks" != no; then
      $run $rm "$lockfile"
    fi

    exit $EXIT_SUCCESS
    ;;

  # libtool link mode
  link | relink)
    modename="$modename: link"

cci-src/src/base/porting.h  view on Meta::CPAN

	port_win_mutex_init_and_lock (mutex);
      }

    return 0;
  }

  __inline int pthread_mutex_unlock (pthread_mutex_t * mutex)
  {
    if (mutex->csp->LockCount == -1)
      {
	/* this means unlock mutex which isn't locked */
	assert (0);
	return 0;
      }

    LeaveCriticalSection (mutex->csp);
    return 0;
  }

  __inline int pthread_mutex_trylock (pthread_mutex_t * mutex)
  {

cci-src/src/base/porting.h  view on Meta::CPAN

 *  #else
 *   ... leave legacy codes or write codes without atomic builtins ...
 *  #endif
 *
 * ATOMIC_TAS_xx (atomic test-and-set) writes new_val into *ptr, and returns
 * the previous contents of *ptr. ATOMIC_CAS_xx (atomic compare-and-swap) returns
 * true if the swap is done. It is only done if *ptr equals to cmp_val.
 * ATOMIC_INC_xx (atomic increment) returns the result of *ptr + amount.
 *
 * Regarding Windows, there are two types of APIs to provide atomic operations.
 * While InterlockedXXX functions handles 32bit values, InterlockedXXX64 handles
 * 64bit values. That is why we define two types of macros.
 */
#if defined (WINDOWS)

#define HAVE_ATOMIC_BUILTINS

#define ATOMIC_TAS_32(ptr, new_val) \
	InterlockedExchange(ptr, new_val)
#define ATOMIC_CAS_32(ptr, cmp_val, swap_val) \
	(InterlockedCompareExchange(ptr, swap_val, cmp_val) == (cmp_val))
#define ATOMIC_INC_32(ptr, amount) \
	(InterlockedExchangeAdd(ptr, amount) + (amount))
#define MEMORY_BARRIER() \
	MemoryBarrier()

#if defined (_WIN64)
#define ATOMIC_TAS_64(ptr, new_val) \
	InterlockedExchange64(ptr, new_val)
#define ATOMIC_CAS_64(ptr, cmp_val, swap_val) \
	(InterlockedCompareExchange64(ptr, swap_val, cmp_val) == (cmp_val))
#define ATOMIC_INC_64(ptr, amount) \
	(InterlockedExchangeAdd64(ptr, amount) + (amount))

#define ATOMIC_TAS_ADDR(ptr, new_val) ATOMIC_TAS_64 ((long long volatile *) ptr, (long long) new_val)
#define ATOMIC_CAS_ADDR(ptr, cmp_val, swap_val) \
	(InterlockedCompareExchange64((long long volatile *) ptr, (long long) swap_val, (long long) cmp_val) \
         == (long long) cmp_val)

#define ATOMIC_LOAD_64(ptr) (*(ptr))
#define ATOMIC_STORE_64(ptr, val) (*(ptr) = val)
#else				/* _WIN64 */
/*
 * These functions are used on Windows 32bit OS.
 * InterlockedXXX64 functions are provided by Windows Vista (client)/Windows
 * 2003 (server) or later versions. So, Windows XP 32bit does not have them.
 * We provide the following functions to support atomic operations on all
 * Windows versions.
 */
  extern UINT64 win32_compare_exchange64 (UINT64 volatile *val_ptr, UINT64 swap_val, UINT64 cmp_val);
  extern UINT64 win32_exchange_add64 (UINT64 volatile *ptr, UINT64 amount);
  extern UINT64 win32_exchange64 (UINT64 volatile *ptr, UINT64 new_val);

#define ATOMIC_TAS_64(ptr, new_val) \
	win32_exchange64(ptr, new_val)
#define ATOMIC_CAS_64(ptr, cmp_val, swap_val) \
	(win32_compare_exchange64(ptr, swap_val, cmp_val) == (cmp_val))
#define ATOMIC_INC_64(ptr, amount) \
	(win32_exchange_add64(ptr, amount) + (amount))

#define ATOMIC_TAS_ADDR(ptr, new_val) ATOMIC_TAS_32 ((long volatile *) ptr, (long long) new_val)
#define ATOMIC_CAS_ADDR(ptr, cmp_val, swap_val) \
	(InterlockedCompareExchange((long volatile *) ptr, (long long) swap_val, (long long) cmp_val) \
         == (long long) (cmp_val))

#define ATOMIC_LOAD_64(ptr) ATOMIC_INC_64 (ptr, 0)
#define ATOMIC_STORE_64(ptr, val) ATOMIC_TAS_64 (ptr, val)
#endif				/* _WIN64 */

#else				/* WINDOWS */

#if defined (HAVE_GCC_ATOMIC_BUILTINS)

cci-src/src/cci/cci_mutex.h  view on Meta::CPAN


    int unlock ()
    {
      return pthread_mutex_unlock (&mutex);
    }
  };

  class _MutexAutolock
  {
  public:
    explicit _MutexAutolock (_Mutex * mutex):mutex (mutex), is_unlocked (true)
    {
      mutex->lock ();
    }

    virtual ~ _MutexAutolock ()
    {
      unlock ();
    }

    void unlock ()
    {
      if (is_unlocked)
	{
	  is_unlocked = false;
	  mutex->unlock ();
	}
    }

  private:
    _Mutex * mutex;
    bool is_unlocked;

    _MutexAutolock (const _MutexAutolock &);
    void operator= (const _MutexAutolock &);
  };
}


#endif /* CCI_MUTEX_H_ */



( run in 0.605 second using v1.01-cache-2.11-cpan-49f99fa48dc )