/*  -
   Copyright (C) 2006 Weongyo Jeong (weongyo@gmail.com)

This file is part of ROVM.

ROVM is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

ROVM is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.  */

#include "types.h"
#include "mpool.h"
#include "thread_mutex.h"

/*
  이 파일에는 사용 중인 locking 메카니즘에 대한 wrapper 들로 구성되어 있습니다.

  !노트! 매크로를 이용하지 않는 이유는 디버깅을 위해서 입니다.
 */

/**
   Lock 을 시도한다.

   @param m	Thread Mutex 포인터.
 */
rc_status_t
rc_thread_mutex_lock (m)
     rc_thread_mutex_t *m;
{
  return apr_thread_mutex_lock (m);
}

/**
   TryLock 을 시도한다.

   @param m	Thread Mutex 포인터.
 */
rc_status_t
rc_thread_mutex_trylock (m)
     rc_thread_mutex_t *m;
{
  return apr_thread_mutex_trylock (m);
}

/**
   Unlock 을 시도한다.

   @param m	Thread Mutex 포인터.
 */
rc_status_t
rc_thread_mutex_unlock (m)
     rc_thread_mutex_t *m;
{
  return apr_thread_mutex_unlock (m);
}

/**
   Thread Mutex 를 생성한다.  이 함수는 Memory Pool 을 이용한다.

   @param m	생성될 Mutex 포인터
   @param flags	옵션
   @param p	Memory pool 포인터
 */
rc_status_t
rc_thread_mutex_create (m, flags, p)
     rc_thread_mutex_t **m;
     unsigned int flags;
     rc_pool_t *p;
{
  return apr_thread_mutex_create (m, flags, p);
}

/**
   생성된 thread mutex 를 제거한다.

   @param m	제거할 thread mutex 포인터
 */
rc_status_t
rc_thread_mutex_destroy (m)
     rc_thread_mutex_t *m;
{
  return apr_thread_mutex_destroy (m);
}
