Ejemplo n.º 1
0
void sync_cont_delete(void* h)
{
	sync_hmr_container_t * cont = (sync_hmr_container_t *)h;
	SEM_DESTROY(cont->buffs_clean.sem);
	SEM_DESTROY(cont->buffs_filled.sem);

	free(h);
}
Ejemplo n.º 2
0
// Commented out until we add ->deconfig() to the DAL
void mc_deconfig(struct DAL *dal) {
   MC_Config *config = (MC_Config*)dal->global_state;
   WAIT(&config->lock);

   close(config->degraded_log_fd);
   SEM_DESTROY(&config->lock);
   free(config);
}
Ejemplo n.º 3
0
int stream_close(ObjectStream* os) {

   LOG(LOG_INFO, "entry\n");
   if (! (os->flags & OSF_OPEN)) {
      LOG(LOG_ERR, "%s isn't open\n", os->url);
      errno = EINVAL;            /* ?? */
      return -1;
   }

   SEM_DESTROY(&os->iob_empty);
   SEM_DESTROY(&os->iob_full);

   os->flags &= ~(OSF_OPEN);
   os->flags |= OSF_CLOSED;     /* so stream_open() can identify re-opens */

#if 0
   // COMMENTED OUT.  Connections are apparently not getting stuck in
   // CLOSE_WAIT, anymore, and forcibly resetting like this causes open()
   // to take significantly longer, such that heavily-loaded sproxyd
   // servers more-frequently fail to respond to the Expect-100-Continue
   // within the (default) 1 second.
   //
   // If you have to uncomment this someday, consider simultaneously either
   // (a) do not add an expect-continue header, or (b) use the
   // CURLOPT_EXPECT_100_TIMEOUT_MS options (requires libcurl >= 7.38)

   // don't leave file-descriptor in CLOSE_WAIT
   LOG(LOG_INFO, "abandoning connection\n");
   aws_reset_connection_r(os->iob.context);
#endif

   int retval;
   if      ((os->op_rc == CURLE_ABORTED_BY_CALLBACK)
            && (os->flags & OSF_ABORT))
      retval = 0;
   else if ((os->op_rc == CURLE_WRITE_ERROR)
            && (os->flags & OSF_JOINED))
      retval = 0;
   else {
      errno = (os->op_rc ? EIO : 0);
      retval = os->op_rc;
   }
   LOG(LOG_INFO, "done (returning %d)\n", retval);
   return retval;
}
Ejemplo n.º 4
0
/*======================================================================
----------------------------------------------------------------------*/
VOID DestroyPurge(PURGE *purge)
   {
   ASSERT(purge != NULL);

   MUTEX_DESTROY(&purge->mutex);
   SEM_DESTROY(&purge->semaphore);

   return ;
   }  /* end DestroyPurge() */
Ejemplo n.º 5
0
void controller_free()
{
    for (long i = 1 ; i < global_numThreads ; i++)
    {
        SEM_DESTROY(global_metadata[i].semaphore);
    }
    P_FREE(global_metadata);
    global_metadata = NULL;
    pthread_join(controllerThread, NULL);
}
Ejemplo n.º 6
0
void workqueue_destroy(WORKQUEUE* queue)
{
    int i;

    SEM_WAIT(&queue->lock);
    ASSERT(queue->state == STATE_INIT);
    ASSERT(queue->work_items->entries == 0);
    queue->state = STATE_EXITING;
    SEM_POST(&queue->lock);

    for (i=0; i<queue->thread_count; i++) {
        SEM_POST(&queue->cond);
    }

    while (queue->thread_count != 0) {
        YIELD();
    }

    bp_queue_free(queue->work_items);
    SEM_DESTROY(&queue->cond);
    SEM_DESTROY(&queue->lock);
    lib_free(queue);
}
Ejemplo n.º 7
0
void openavbAcmpSMControllerStop()
{
	AVB_TRACE_ENTRY(AVB_TRACE_ACMP);

	if (bRunning) {
		openavbAcmpSMControllerSet_doTerminate(TRUE);

		THREAD_JOIN(openavbAcmpSmControllerThread, NULL);
	}

	SEM_ERR_T(err);
	SEM_DESTROY(openavbAcmpSMControllerSemaphore, err);
	SEM_LOG_ERR(err);

	openavbListDeleteList(openavbAcmpSMControllerVars.inflight);

	AVB_TRACE_EXIT(AVB_TRACE_ACMP);
}
Ejemplo n.º 8
0
void queue_destroy(queue *queue)
{
	SEM_DESTROY(queue->sem);
	free(queue);
}