Displaying 1 result from an estimated 1 matches for "test_pthread_malloc_func".
2012 Oct 11
1
memory allocation in new thread
...e TEST_MALLOC() \
{ \
??? void *p; \
??? p = malloc(1); \
??? if (!p) { \
??? ??? i_info("%s: malloc() failed", __FUNCTION__); \
??? } else { \
??? ??? i_info("%s: malloc() succeeded", __FUNCTION__); \
??? ??? free(p); \
??? } \
}
#include <pthread.h>
static void *test_pthread_malloc_func(void *data_)
{
??? TEST_MALLOC();
??? return NULL;
}
static void test_pthread_malloc()
{
??? int ret;
??? pthread_t tid;
??? TEST_MALLOC();
??? ret = pthread_create(&tid, NULL, test_pthread_malloc_func, NULL);
??? if (ret) {
??????? i_info("failed to start thread");
??? } el...