[14] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Two new functions for pthread

daemon@ATHENA.MIT.EDU (H.J. Lu)
Tue Jun 13 00:05:33 1995

From: hjl@nynexst.com (H.J. Lu)
To: proven@MIT.EDU
Date: Mon, 12 Jun 1995 23:46:47 -0400 (EDT)
Cc: pthreads@MIT.EDU

While putting pthreads into the Linux C library, I found out I need
those two functions. I added them to the pthreads library. The
idea is the C library should not know the internal structure of
pthreads. Pointers are ok. But Structures are not.


H.J.
-----
#include <pthread.h>
#include <malloc.h>

pthread_mutex_t *
__pthread_mutex_malloc (const pthread_mutexattr_t *attr)
{
  pthread_mutex_t *mutex =
	(pthread_mutex_t*) malloc (sizeof (pthread_mutex_t));

  if (mutex)
  {
    pthread_mutex_init (mutex, attr);
  }
  return mutex;
}

void
__pthread_mutex_free (pthread_mutex_t *mutex)
{
  free (mutex);
}

home help back first fref pref prev next nref lref last post