Index: /trunk/include/cf_mutex.h
===================================================================
--- /trunk/include/cf_mutex.h	(revision 126)
+++ /trunk/include/cf_mutex.h	(revision 126)
@@ -0,0 +1,38 @@
+/**
+ * \file	cf_mutex.h
+ * \author	myusgun <myusgun@gmail.com>
+ *
+ * \brief 뮤텍스 지원
+ *
+ * \example thread.c
+ */
+#ifndef __CF_MUTEX_H__
+#define __CF_MUTEX_H__
+
+#include "cf_base.h"
+
+/** 뮤텍스 컨텍스트 */
+typedef void *	CF_Mutex_Ctx;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+CF_EXPORT int
+CF_Mutex_CreateCtx		(CF_Mutex_Ctx * ctx);
+
+CF_EXPORT int
+CF_Mutex_DestoryCtx		(CF_Mutex_Ctx ctx);
+
+CF_EXPORT int
+CF_Mutex_Lock			(CF_Mutex_Ctx ctx);
+
+CF_EXPORT int
+CF_Mutex_Unlock			(CF_Mutex_Ctx ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // #ifndef __CF_MUTEX_H__
+
Index: /trunk/include/cf_thread.h
===================================================================
--- /trunk/include/cf_thread.h	(revision 125)
+++ /trunk/include/cf_thread.h	(revision 126)
@@ -3,5 +3,5 @@
  * \author	myusgun <myusgun@gmail.com>
  *
- * \brief 멀티스레드 및 뮤텍스 지원
+ * \brief 멀티스레드 지원
  *
  * \example thread.c
@@ -12,4 +12,6 @@
 #include "cf_base.h"
 
+#include "cf_mutex.h"
+
 /** 스레드 워커 함수 프로토타입 */
 typedef int (* CF_Thread_Function) (void *);
@@ -17,7 +19,4 @@
 /** 스레드 컨텍스트 */
 typedef void *	CF_Thread_Ctx;
-
-/** 뮤텍스 컨텍스트 */
-typedef void *	CF_Mutex_Ctx;
 
 #ifdef __cplusplus
@@ -39,16 +38,4 @@
 CF_Thread_Join			(CF_Thread_Ctx ctx);
 
-CF_EXPORT int
-CF_Mutex_CreateCtx		(CF_Mutex_Ctx * ctx);
-
-CF_EXPORT int
-CF_Mutex_DestoryCtx		(CF_Mutex_Ctx ctx);
-
-CF_EXPORT int
-CF_Mutex_Lock			(CF_Mutex_Ctx ctx);
-
-CF_EXPORT int
-CF_Mutex_Unlock			(CF_Mutex_Ctx ctx);
-
 #ifdef __cplusplus
 }
Index: /trunk/src/cf_mutex.c
===================================================================
--- /trunk/src/cf_mutex.c	(revision 126)
+++ /trunk/src/cf_mutex.c	(revision 126)
@@ -0,0 +1,156 @@
+/**
+ * \file	cf_mutex.c
+ * \author	myusgun <myusgun@gmail.com>
+ *
+ * \brief 뮤텍스 구현
+ */
+#include "cf_mutex.h"
+#include "cf_local.h"
+#include "cf_error.h"
+
+#include <stdlib.h>
+
+#if defined(_WIN32) || defined(_WIN64)
+# include <windows.h>
+# include <process.h>
+# define MUTEX_TYPE		HANDLE
+#else // #if defined(_WIN32) || defined(_WIN64)
+# include <pthread.h>
+# define MUTEX_TYPE		pthread_mutex_t
+#endif // #if defined(_WIN32) || defined(_WIN64)
+
+#define ASSERT_MUTEX_CTX(__ctx)	\
+	if (__ctx == NULL)			\
+		return CF_ERROR_MUTEX_INVALID_CTX
+
+typedef struct __cf_ctx_ctx__
+{
+	MUTEX_TYPE	mid;
+} CF_MUTEX_CTX;
+
+static int
+CF_Mutex_Local_Close (MUTEX_TYPE mid)
+{
+#if defined(_WIN32) || defined(_WIN64)
+	if (mid == NULL)
+		return CF_ERROR_MUTEX_INVALID_ARGS;
+
+	CloseHandle (mid);
+#else
+	pthread_mutex_destroy (&mid);
+#endif
+
+	return CF_OK;
+}
+
+/**
+ * 뮤텍스 컨텍스트를 생성
+ *
+ * \return 성공 시, CF_OK; 실패 시, 오류 코드
+ *
+ * \param ctx 뮤텍스 컨텍스트 주소
+ */
+int
+CF_Mutex_CreateCtx (CF_Mutex_Ctx * ctx)
+{
+	int result = 0;
+
+	CF_MUTEX_CTX * context = NULL;
+
+	context = (CF_MUTEX_CTX *) calloc (sizeof (CF_MUTEX_CTX), 1);
+	if (context == NULL)
+		return CF_ERROR_MUTEX_CREATE_CTX;
+
+	TRY
+	{
+#if defined(_WIN32) || defined(_WIN64)
+		context->mid = CreateMutexA (NULL, FALSE, NULL);
+		if (context->mid == NULL)
+		{
+			result = CF_ERROR_MUTEX_CREATE;
+			TRY_BREAK;
+		}
+#else
+		result = pthread_mutex_init (&context->mid, NULL);
+		if (result)
+		{
+			result = CF_ERROR_MUTEX_CREATE;
+			TRY_BREAK;
+		}
+#endif
+
+		*ctx = context;
+	}
+	CATCH_IF (result < 0)
+	{
+		CF_Mutex_DestoryCtx ((CF_Mutex_Ctx) context);
+	}
+
+	return result;
+}
+
+/**
+ * 뮤텍스 컨텍스트 해제
+ *
+ * \return 성공 시, CF_OK; 실패 시, 오류 코드
+ *
+ * \param ctx 뮤텍스 컨텍스트
+ */
+int
+CF_Mutex_DestoryCtx (CF_Mutex_Ctx ctx)
+{
+	CF_MUTEX_CTX * context = ctx;
+
+	ASSERT_MUTEX_CTX (ctx);
+
+	CF_Mutex_Local_Close (context->mid);
+	free (context);
+
+	return CF_OK;
+}
+
+/**
+ * 뮤텍스 잠금
+ *
+ * \return 성공 시, CF_OK; 실패 시, 오류 코드
+ *
+ * \param ctx 뮤텍스 컨텍스트
+ */
+int
+CF_Mutex_Lock (CF_Mutex_Ctx ctx)
+{
+	CF_MUTEX_CTX * context = ctx;
+
+	ASSERT_MUTEX_CTX (ctx);
+
+#if defined(_WIN32) || defined(_WIN64)
+	WaitForSingleObject (context->mid, INFINITE);
+#else
+	pthread_mutex_lock (&context->mid);
+#endif
+
+	return CF_OK;
+}
+
+/**
+ * 뮤텍스 잠금 해제
+ *
+ * \return 성공 시, CF_OK; 실패 시, 오류 코드
+ *
+ * \param ctx 뮤텍스 컨텍스트
+ */
+int
+CF_Mutex_Unlock (CF_Mutex_Ctx ctx)
+{
+	CF_MUTEX_CTX * context = ctx;
+
+	ASSERT_MUTEX_CTX (ctx);
+
+#if defined(_WIN32) || defined(_WIN64)
+	ReleaseMutex (context->mid);
+#else
+	pthread_mutex_unlock (&context->mid);
+#endif
+
+	return CF_OK;
+}
Index: /trunk/src/cf_thread.c
===================================================================
--- /trunk/src/cf_thread.c	(revision 125)
+++ /trunk/src/cf_thread.c	(revision 126)
@@ -3,8 +3,7 @@
  * \author	myusgun <myusgun@gmail.com>
  *
- * \brief 멀티 스레드 및 뮤텍스 구현
+ * \brief 멀티 스레드 구현
  */
 #include "cf_thread.h"
-#include "cf_local.h"
 #include "cf_error.h"
 
@@ -30,8 +29,4 @@
 		return CF_ERROR_THREAD_INVALID_CTX
 
-#define ASSERT_MUTEX_CTX(__ctx)	\
-	if (__ctx == NULL)			\
-		return CF_ERROR_MUTEX_INVALID_CTX
-
 typedef THREAD_RETURN (THREAD_CALL * THREAD_WORKER) (void *);
 
@@ -43,9 +38,4 @@
 } CF_THREAD_CTX;
 
-typedef struct __cf_ctx_ctx__
-{
-	MUTEX_TYPE	mid;
-} CF_MUTEX_CTX;
-
 static int
 CF_Thread_Local_Close (THREAD_TYPE tid)
@@ -56,19 +46,4 @@
 
 	CloseHandle (tid);
-#endif
-
-	return CF_OK;
-}
-
-static int
-CF_Mutex_Local_Close (MUTEX_TYPE mid)
-{
-#if defined(_WIN32) || defined(_WIN64)
-	if (mid == NULL)
-		return CF_ERROR_MUTEX_INVALID_ARGS;
-
-	CloseHandle (mid);
-#else
-	pthread_mutex_destroy (&mid);
 #endif
 
@@ -213,114 +188,2 @@
 	return CF_OK;
 }
-
-/**
- * 뮤텍스 컨텍스트를 생성
- *
- * \return 성공 시, CF_OK; 실패 시, 오류 코드
- *
- * \param ctx 뮤텍스 컨텍스트 주소
- */
-int
-CF_Mutex_CreateCtx (CF_Mutex_Ctx * ctx)
-{
-	int result = 0;
-
-	CF_MUTEX_CTX * context = NULL;
-
-	context = (CF_MUTEX_CTX *) calloc (sizeof (CF_MUTEX_CTX), 1);
-	if (context == NULL)
-		return CF_ERROR_MUTEX_CREATE_CTX;
-
-	TRY
-	{
-#if defined(_WIN32) || defined(_WIN64)
-		context->mid = CreateMutexA (NULL, FALSE, NULL);
-		if (context->mid == NULL)
-		{
-			result = CF_ERROR_MUTEX_CREATE;
-			TRY_BREAK;
-		}
-#else
-		result = pthread_mutex_init (&context->mid, NULL);
-		if (result)
-		{
-			result = CF_ERROR_MUTEX_CREATE;
-			TRY_BREAK;
-		}
-#endif
-
-		*ctx = context;
-	}
-	CATCH_IF (result < 0)
-	{
-		CF_Mutex_DestoryCtx ((CF_Mutex_Ctx) context);
-	}
-
-	return result;
-}
-
-/**
- * 뮤텍스 컨텍스트 해제
- *
- * \return 성공 시, CF_OK; 실패 시, 오류 코드
- *
- * \param ctx 뮤텍스 컨텍스트
- */
-int
-CF_Mutex_DestoryCtx (CF_Mutex_Ctx ctx)
-{
-	CF_MUTEX_CTX * context = ctx;
-
-	ASSERT_MUTEX_CTX (ctx);
-
-	CF_Mutex_Local_Close (context->mid);
-	free (context);
-
-	return CF_OK;
-}
-
-/**
- * 뮤텍스 잠금
- *
- * \return 성공 시, CF_OK; 실패 시, 오류 코드
- *
- * \param ctx 뮤텍스 컨텍스트
- */
-int
-CF_Mutex_Lock (CF_Mutex_Ctx ctx)
-{
-	CF_MUTEX_CTX * context = ctx;
-
-	ASSERT_MUTEX_CTX (ctx);
-
-#if defined(_WIN32) || defined(_WIN64)
-	WaitForSingleObject (context->mid, INFINITE);
-#else
-	pthread_mutex_lock (&context->mid);
-#endif
-
-	return CF_OK;
-}
-
-/**
- * 뮤텍스 잠금 해제
- *
- * \return 성공 시, CF_OK; 실패 시, 오류 코드
- *
- * \param ctx 뮤텍스 컨텍스트
- */
-int
-CF_Mutex_Unlock (CF_Mutex_Ctx ctx)
-{
-	CF_MUTEX_CTX * context = ctx;
-
-	ASSERT_MUTEX_CTX (ctx);
-
-#if defined(_WIN32) || defined(_WIN64)
-	ReleaseMutex (context->mid);
-#else
-	pthread_mutex_unlock (&context->mid);
-#endif
-
-	return CF_OK;
-}
Index: /trunk/src/makefile
===================================================================
--- /trunk/src/makefile	(revision 125)
+++ /trunk/src/makefile	(revision 126)
@@ -12,4 +12,5 @@
 					cf_socket		\
 					cf_thread		\
+					cf_mutex		\
 					cf_debug		\
 					cf_log			\
