/**@internal
 *
 * Initializes a message port. It creates a mailbox used to wake up the
 * thread waiting on the port if needed. Currently, the mailbox is a
 * socketpair or an UDP socket connected to itself.
 */
int su_pthread_port_init(su_port_t *self, su_port_vtable_t const *vtable)
{
  SU_DEBUG_9(("su_pthread_port_init(%p, %p) called\n",
	      (void *)self, (void *)vtable));

  pthread_mutex_init(self->sup_obtained, NULL);

  return su_base_port_init(self, vtable);
}
Example #2
0
/** Initialize source port */
static int su_source_port_init(su_port_t *self,
			       su_port_vtable_t const *vtable)
{
  GSource *gs = (GSource *)((char *)self - offsetof(SuSource, ss_port));

  self->sup_source = gs;

  g_static_mutex_init(self->sup_obtained);

  g_static_mutex_init(self->sup_mutex);

  return su_base_port_init(self, vtable);
}