summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunyan He <junyan.he@intel.com>2016-04-22 00:44:15 +0800
committerJunyan He <junyan.he@intel.com>2016-04-22 00:44:15 +0800
commitf28beafebb9208186b98605906a474c6c4ba6126 (patch)
treea675f765216144d4ca00f8288e9dc8c8f94c433a
parent98147a423cf8ad0f90d06ac597cbd53a78be77dd (diff)
cond
-rw-r--r--libclapi/cl_mutex.h35
1 files changed, 10 insertions, 25 deletions
diff --git a/libclapi/cl_mutex.h b/libclapi/cl_mutex.h
index fde52f30..21fa44c0 100644
--- a/libclapi/cl_mutex.h
+++ b/libclapi/cl_mutex.h
@@ -14,37 +14,22 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
- * Author: Benjamin Segovia <benjamin.segovia@intel.com>
*/
-#ifndef __CL_ALLOC_H__
-#define __CL_ALLOC_H__
+#ifndef __CL_MUTEX_H__
+#define __CL_MUTEX_H__
#include <stdlib.h>
+#include <pthread.h>
/* Return a valid pointer for the requested memory block size */
-extern void* cl_malloc(size_t sz, char* file, int line);
-#define CL_MALLOC(SZ) cl_malloc(SZ, __FILE__, __LINE__)
+extern void cl_mutex_lock(pthread_mutex_t* mutex, char* file, int line);
+#define CL_MUTEX_LOCK(mutex) cl_mutex_lock(mutex, __FILE__, __LINE__)
-/* Aligned malloc */
-extern void* cl_aligned_malloc(size_t sz, size_t align, char* file, int line);
-#define CL_ALIGNED_MALLOC(SZ, ALIGN) cl_aligned_malloc(SZ, ALIGN, __FILE__, __LINE__)
+extern void cl_mutex_unlock(pthread_mutex_t* mutex, char* file, int line);
+#define CL_MUTEX_UNLOCK(mutex) cl_mutex_unlock(mutex, __FILE__, __LINE__)
-/* malloc + memzero */
-extern void* cl_calloc(size_t n, size_t elem_size, char* file, int line);
-#define CL_CALLOC(N, ELEM_SIZE) cl_calloc(N, ELEM_SIZE, __FILE__, __LINE__)
+extern int cl_cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex, char* file, int line);
+#define CL_COND_WAIT(cond, mutex) cl_cond_wait(cond, mutex, __FILE__, __LINE__)
-/* Regular realloc */
-extern void* cl_realloc(void *ptr, size_t sz, char* file, int line);
-#define CL_REALLOC(PTR, SZ) cl_realloc(PTR, SZ, __FILE__, __LINE__)
-
-/* Free a pointer allocated with cl_*alloc */
-extern void cl_free(void *ptr, char* file, int line);
-#define CL_FREE(PTR) cl_free(PTR, __FILE__, __LINE__)
-
-/* We count the number of allocation. This function report the number of
- * allocation still unfreed
- */
-extern void cl_alloc_report_unfreed(void);
-extern void cl_alloc_debug_init(void);
-#endif /* __CL_ALLOC_H__ */
+#endif /* __CL_MUTEX_H__ */