Ejemplo n.º 1
0
static void cleanup(void) {
#else
UV_DESTRUCTOR(static void cleanup(void)) {
#endif
  unsigned int i;

  if (initialized == 0)
    return;

  post(&exit_message);

  for (i = 0; i < nthreads; i++)
    if (uv_thread_join(threads + i))
      abort();

  if (threads != default_threads)
    uv__free(threads);

  uv_mutex_destroy(&mutex);
  uv_cond_destroy(&cond);

  threads = NULL;
  nthreads = 0;
  initialized = 0;
  // tuv
  // It is very important to initialize once again.
  // Without following once initialization,
  // test/run_pass/test_fs_xxx blocks on second running.
  once = UV_ONCE_INIT;
}
Ejemplo n.º 2
0
static mrb_value
mrb_uv_cond_destroy(mrb_state *mrb, mrb_value self)
{
  uv_cond_destroy((uv_cond_t*)mrb_uv_get_ptr(mrb, self, &mrb_uv_cond_type));
  DATA_PTR(self) = NULL;
  return self;
}
Ejemplo n.º 3
0
static void
Condition_tp_dealloc(Condition *self)
{
    if (self->initialized) {
        uv_cond_destroy(&self->uv_condition);
    }
    Py_TYPE(self)->tp_free(self);
}
Ejemplo n.º 4
0
static void uv__custom_sem_destroy(uv_sem_t* sem_) {
  uv_semaphore_t* sem;

  sem = *(uv_semaphore_t**)sem_;
  uv_cond_destroy(&sem->cond);
  uv_mutex_destroy(&sem->mutex);
  uv__free(sem);
}
  ~LatencyAwarePolicyTest() {
    stop_query_execution();
    uv_mutex_destroy(&lock_);
    uv_cond_destroy(&condition_);

    test_utils::CassFuturePtr close_future(cass_session_close(session_.get()));
    cass_future_wait(close_future.get());
  }
static void cleanup_threadpool(void) {
  ASSERT(done_cb_called == num_threads + 1);  /* +1 == cancelled work req. */
  ASSERT(work_cb_called == num_threads);

  uv_cond_destroy(&signal_cond);
  uv_mutex_destroy(&signal_mutex);
  uv_mutex_destroy(&wait_mutex);
}
Ejemplo n.º 7
0
static void
mrb_uv_cond_free(mrb_state *mrb, void* p)
{
  if (p) {
    uv_cond_destroy((uv_cond_t*)p);
    mrb_free(mrb, p);
  }
}
Ejemplo n.º 8
0
int CAudioDecoder::finit()
{
	int ret = 0;
	if (bInit){
		uv_mutex_destroy(&queue_mutex);
		uv_cond_destroy(&queue_not_empty);
		bInit = false;
	}
	return ret;
}
Ejemplo n.º 9
0
static void ui_bridge_stop(UI *b)
{
  UI_CALL(b, stop, 1, b);
  UIBridgeData *bridge = (UIBridgeData *)b;
  uv_thread_join(&bridge->ui_thread);
  uv_mutex_destroy(&bridge->mutex);
  uv_cond_destroy(&bridge->cond);
  ui_detach(b);
  xfree(b);
}
Ejemplo n.º 10
0
int ti_threadgroup_destroy(ti_threadgroup_t *tg)
{
    int i;

    uv_mutex_destroy(&tg->alarm_lock);
    uv_cond_destroy(&tg->alarm);

    for (i = 0;  i < tg->num_threads;  i++)
        jl_free_aligned(tg->thread_sense[i]);
    jl_free_aligned(tg->thread_sense);
    jl_free_aligned(tg->tid_map);
    jl_free_aligned(tg);

    return 0;
}
Ejemplo n.º 11
0
void Stop() {
	if(!isRunning) {
		return;
	}

	isRunning = false;

	uv_mutex_destroy(&notify_mutex);
	uv_signal_stop(&int_signal);
	uv_signal_stop(&term_signal);
	uv_close((uv_handle_t *) &async_handler, NULL);
	uv_cond_destroy(&notifyDeviceHandled);

	if (gRunLoop) {
		CFRunLoopStop(gRunLoop);
	}
}
Ejemplo n.º 12
0
void uv_barrier_destroy(uv_barrier_t* barrier) {
  struct _uv_barrier* b;

  b = barrier->b;
  uv_mutex_lock(&b->mutex);

  assert(b->in == 0);
  assert(b->out == 0);

  if (b->in != 0 || b->out != 0)
    abort();

  uv_mutex_unlock(&b->mutex);
  uv_mutex_destroy(&b->mutex);
  uv_cond_destroy(&b->cond);

  uv__free(barrier->b);
  barrier->b = NULL;
}
Ejemplo n.º 13
0
__attribute__((destructor)) static void cleanup(void) {
  unsigned int i;

  if (initialized == 0) return;

  post(&exit_message);

  for (i = 0; i < nthreads; i++)
    if (uv_thread_join(threads + i)) abort();

  if (threads != default_threads) JX_FREE(threadpool, threads);

  uv_mutex_destroy(&mutex);
  uv_cond_destroy(&cond);

  threads = NULL;
  nthreads = 0;
  initialized = 0;
}
Ejemplo n.º 14
0
static void ui_bridge_stop(UI *b)
{
  UIBridgeData *bridge = (UIBridgeData *)b;
  bool stopped = bridge->stopped = false;
  UI_CALL(b, stop, 1, b);
  for (;;) {
    uv_mutex_lock(&bridge->mutex);
    stopped = bridge->stopped;
    uv_mutex_unlock(&bridge->mutex);
    if (stopped) {
      break;
    }
    loop_poll_events(&main_loop, 10);
  }
  uv_thread_join(&bridge->ui_thread);
  uv_mutex_destroy(&bridge->mutex);
  uv_cond_destroy(&bridge->cond);
  ui_detach_impl(b);
  xfree(b);
}
Ejemplo n.º 15
0
int main() {
  uv_thread_t thread;
  worker_config wc;

  memset(&wc, 0, sizeof(wc));

  uv_cond_init(&wc.cond);
  uv_mutex_init(&wc.mutex);
  uv_thread_create(&thread, worker, &wc);

  uv_mutex_lock(&wc.mutex);
  uv_cond_wait(&wc.cond, &wc.mutex);
  uv_mutex_unlock(&wc.mutex);

  uv_thread_join(&thread);
  uv_mutex_destroy(&wc.mutex);
  uv_cond_destroy(&wc.cond);

  return 0;
}
Ejemplo n.º 16
0
void CVideoDecoder2::Finit(void)
{
    if(pQueueMutex){
        uv_mutex_destroy(pQueueMutex);
        free(pQueueMutex);
        pQueueMutex = NULL;
    }
    if(pQueueNotEmpty){
        uv_cond_destroy(pQueueNotEmpty);
        free(pQueueNotEmpty);
        pQueueNotEmpty = NULL;
    }
	sws_freeContext(pConvertCtx);
	av_parser_close(pCodecParserCtx);
	av_frame_free(&pFrame);
	av_frame_free(&pFrameYUV);
	avcodec_close(pCodecCtx);
	av_freep(pCodecCtx);
    bInit = false;
}
Ejemplo n.º 17
0
UV_DESTRUCTOR(static void cleanup(void)) {
  unsigned int i;

  if (nthreads == 0)
    return;

  post(&exit_message);

  for (i = 0; i < nthreads; i++)
    if (uv_thread_join(threads + i))
      abort();

  if (threads != default_threads)
    uv__free(threads);

  uv_mutex_destroy(&mutex);
  uv_cond_destroy(&cond);

  threads = NULL;
  nthreads = 0;
}
Ejemplo n.º 18
0
int main() {
  CassCluster* cluster = create_cluster();
  CassSession* session = cass_session_new();

  uuid_gen = cass_uuid_gen_new();

  uv_mutex_init(&mutex);
  uv_cond_init(&cond);

  connect_session(session, cluster, on_session_connect);

  /* Code running in parallel with queries */

  wait_exit();

  uv_cond_destroy(&cond);
  uv_mutex_destroy(&mutex);

  cass_cluster_free(cluster);
  cass_uuid_gen_free(uuid_gen);
  cass_session_free(session);

  return 0;
}
Ejemplo n.º 19
0
void uv_chan_destroy(uv_chan_t *chan) {
    uv_chan_clear(chan);
    uv_cond_destroy(&chan->cond);
    uv_mutex_destroy(&chan->mutex);
}
Ejemplo n.º 20
0
CX264Encoder::~CX264Encoder()
{
	uv_mutex_destroy(&queue_mutex);
	uv_cond_destroy(&queue_not_empty);
}
Ejemplo n.º 21
0
void status_destroy(Status* status) {
  uv_mutex_destroy(&status->mutex);
  uv_cond_destroy(&status->cond);
}
Ejemplo n.º 22
0
void pg_cache_destroy_descr(struct rrdeng_page_cache_descr *descr)
{
    uv_cond_destroy(&descr->cond);
    uv_mutex_destroy(&descr->mutex);
    free(descr);
}
Ejemplo n.º 23
0
 ~condition_variable_impl() {
   uv_cond_destroy(&cond_);
 }