コード例 #1
0
ファイル: rsys.c プロジェクト: onixion/pandarus
int rsys_render_req(struct rsys* rsys, rsys_req_t* req)
{
    ocn_spin_lock(&rsys->render_reqs_lock);
    queue_push(&rsys->render_reqs, req);
    ocn_spin_unlock(&rsys->render_reqs_lock);
    return OCN_OK;
}
コード例 #2
0
ファイル: thread_pool.c プロジェクト: lvchao0428/ultrapp
void thread_pool_add_task_to_queue(pool_t *pool, task_t task)
{
    pthread_mutex_lock(&pool->mutex_);
    queue_push(&pool->queue_, task);
    pthread_cond_signal(&pool->cond_);
    pthread_mutex_unlock(&pool->mutex_);
}
コード例 #3
0
ファイル: read_all.c プロジェクト: sathnaga/ltp
static void stop_workers(void)
{
	const char stop_code[1] = { '\0' };
	int i, stop_attempts;

	if (!workers)
		return;

	for (i = 0; i < worker_count; i++) {
		stop_attempts = 0xffff;
		if (workers[i].q) {
			while (!queue_push(workers[i].q, stop_code)) {
				if (--stop_attempts < 0) {
					tst_brk(TBROK,
						"Worker %d is stalled",
						workers[i].pid);
					break;
				}
			}
		}
	}

	for (i = 0; i < worker_count; i++) {
		if (workers[i].q) {
			queue_destroy(workers[i].q, 0);
			workers[i].q = 0;
		}
	}
}
コード例 #4
0
void connection_close(connection_t *c)
{
  ev_io_stop(c->loop, &c->read_watcher);
  ev_io_stop(c->loop, &c->write_watcher);
  ev_timer_stop(c->loop, &c->timeout_watcher);

  close(c->fd);
  shutdown(c->fd, SHUT_RDWR);
  
  buffer_reset(&c->read_buffer);
  buffer_reset(&c->write_buffer);
  
  /* tell Ruby GC vars are not used anymore */
  rb_gc_unregister_address(&c->env);
  rb_gc_unregister_address(&c->input);
  
  /* kill the thread if still running */
  if (c->thread.active) {
    c->backend->thread_count--;
    rb_thread_kill(c->thread.obj);
  }
  
  /* put back in the queue of unused connections */
  queue_push(&c->backend->connections, c);
}
コード例 #5
0
static void
command(struct skynet_context *ctx, struct package *P, int session, uint32_t source, const char *msg, size_t sz) {
	switch (msg[0]) {
	case 'R':
		// request a package
		if (P->closed) {
			skynet_send(ctx, 0, source, PTYPE_ERROR, session, NULL, 0);
			break;
		}
		if (!queue_empty(&P->response)) {
			assert(queue_empty(&P->request));
			struct response resp;
			queue_pop(&P->response, &resp);
			skynet_send(ctx, 0, source, PTYPE_RESPONSE | PTYPE_TAG_DONTCOPY, session, resp.msg, resp.sz);
		} else {
			struct request req;
			req.source = source;
			req.session = session;
			queue_push(&P->request, &req);
		}
		break;
	case 'K':
		// shutdown the connection
		skynet_socket_shutdown(ctx, P->fd);
		break;
	case 'I':
		report_info(ctx, P, session, source);
		break;
	default:
		// invalid command
		skynet_error(ctx, "Invalid command %.*s", (int)sz, msg);
		skynet_send(ctx, 0, source, PTYPE_ERROR, session, NULL, 0);
		break;
	};
}
コード例 #6
0
ファイル: websocket.c プロジェクト: vszurma/brickd
// sets errno on error
int websocket_send(Socket *socket, void *buffer, int length) {
	Websocket *websocket = (Websocket *)socket;
	WebsocketQueuedData *queued_data;

	if (websocket->state == WEBSOCKET_STATE_HANDSHAKE_DONE ||
	    websocket->state == WEBSOCKET_STATE_HEADER_DONE) {
		return websocket_send_frame(websocket, buffer, length);
	}

	// initial handshake not finished yet
	if (length > 0) {
		queued_data = queue_push(&websocket->send_queue);

		if (queued_data == NULL) {
			return -1;
		}

		queued_data->buffer = malloc(length);
		queued_data->length = length;

		if (queued_data->buffer == NULL) {
			errno = ENOMEM;

			return -1;
		}

		memcpy(queued_data->buffer, buffer, length);
	}

	return length;
}
コード例 #7
0
ファイル: esqlite3_nif.c プロジェクト: chinnurtb/esqlite
static void 
destruct_esqlite_connection(ErlNifEnv *env, void *arg)
{
    esqlite_connection *db = (esqlite_connection *) arg;
    esqlite_command *cmd = command_create();
  
    /* Send the stop command 
     */
    cmd->type = cmd_stop;
    queue_push(db->commands, cmd);
    queue_send(db->commands, cmd);
     
    /* Wait for the thread to finish 
     */
    enif_thread_join(db->tid, NULL);
    enif_thread_opts_destroy(db->opts);
     
    /* The thread has finished... now remove the command queue, and close
     * the datbase (if it was still open).
     */
    queue_destroy(db->commands);

    if(db->db)
	   sqlite3_close(db->db);
}
コード例 #8
0
int actualizacionCriteriosNivel(int iSocketConexion, char* sPayload, tNivel* pNivel, tPersonaje *pPersonajeActual) {
	tInfoNivel* pInfoNivel;
	pInfoNivel = deserializarInfoNivel(sPayload);
	free(sPayload);

	log_debug(logger, "<<< Recibe actualizacion de criterios del nivel");

	pNivel->quantum = pInfoNivel->quantum;
	pNivel->delay   = pInfoNivel->delay;

	if (pNivel->algoritmo != pInfoNivel->algoritmo) {
		pNivel->algoritmo = pInfoNivel->algoritmo;

		if (!nivelVacio(pNivel)) {

			if(pInfoNivel->algoritmo==SRDF){
				if (pPersonajeActual != NULL) {
					pPersonajeActual->quantumUsado = 0;
					queue_push(pNivel->cListos, pPersonajeActual);
				}

				bool _menorRemainingDistance(tPersonaje *unPersonaje, tPersonaje *otroPersonaje) {
					return (unPersonaje->remainingDistance < otroPersonaje->remainingDistance );
				}
				list_sort(pNivel->cListos->elements, (void *)_menorRemainingDistance);
			}
		}
	}
コード例 #9
0
ファイル: cplxdeps.c プロジェクト: iamcourtney/libsolv
void
pool_add_pos_literals_complex_dep(Pool *pool, Id dep, Queue *q, Map *m, int neg)
{
  while (ISRELDEP(dep))
    {
      Reldep *rd = GETRELDEP(pool, dep);
      if (rd->flags != REL_AND && rd->flags != REL_OR && rd->flags != REL_COND)
	break;
      pool_add_pos_literals_complex_dep(pool, rd->name, q, m, neg);
      dep = rd->evr;
      if (rd->flags == REL_COND)
	{
	  neg = !neg;
	  if (ISRELDEP(dep))
	    {
	      Reldep *rd2 = GETRELDEP(pool, rd->evr);
	      if (rd2->flags == REL_ELSE)
		{
	          pool_add_pos_literals_complex_dep(pool, rd2->evr, q, m, !neg);
		  dep = rd2->name;
		}
	    }
	}
    }
  if (!neg)
    {
      Id p, pp;
      FOR_PROVIDES(p, pp, dep)
	if (!MAPTST(m, p))
	  queue_push(q, p);
    }
コード例 #10
0
ファイル: common.c プロジェクト: hornos/pixz
void pipeline_create(
        pipeline_data_create_t create,
        pipeline_data_free_t destroy,
        pipeline_split_t split,
        pipeline_process_t process,
        size_t max_procs) {
    gPLFreer = destroy;
    gPLSplit = split;
    gPLProcess = process;

    gPipelineStartQ = queue_new(pipeline_qfree);
    gPipelineSplitQ = queue_new(pipeline_qfree);
    gPipelineMergeQ = queue_new(pipeline_qfree);

    gPLSplitSeq = 0;
    gPLMergeSeq = 0;
    gPLMergedItems = NULL;

    gPLProcessCount = num_threads(max_procs);
    gPLProcessThreads = malloc(gPLProcessCount * sizeof(pthread_t));
    for (size_t i = 0; i < (int)(gPLProcessCount * 2 + 3); ++i) {
        // create blocks, including a margin of error
        pipeline_item_t *item = malloc(sizeof(pipeline_item_t));
        item->data = create();
        // seq and next are garbage
        queue_push(gPipelineStartQ, PIPELINE_ITEM, item);
    }
    for (size_t i = 0; i < gPLProcessCount; ++i) {
        if (pthread_create(&gPLProcessThreads[i], NULL,
                &pipeline_thread_process, (void*)(uintptr_t)i))
            die("Error creating encode thread");
    }
    if (pthread_create(&gPLSplitThread, NULL, &pipeline_thread_split, NULL))
        die("Error creating read thread");
}
コード例 #11
0
int sacarDeCola(t_queue *cola,listaPersonajesStruct *unPersonaje,char info , t_log *log, pthread_mutex_t *semColas)
{
	t_queue *colaAuxiliar;
	int loEncontre = 0;
	listaPersonajesStruct *personajeEnCola;
	colaAuxiliar = queue_create();

	pthread_mutex_lock(semColas);
	while(!queue_is_empty(cola))
	{
		personajeEnCola = queue_pop(cola);
		if(personajeEnCola->nombre != unPersonaje->nombre)
		{
			queue_push(colaAuxiliar, (void *) personajeEnCola);
		}
		else
		{
			if(info == 'L')
				log_info(log,"Borre de Listos a %s",unPersonaje->nombre);
			if(info == 'B')
				log_info(log,"Borre de Bloqueados a %s",unPersonaje->nombre);
			loEncontre = 1;
		}
	}

	queue_copy(cola,colaAuxiliar);
	pthread_mutex_unlock(semColas);
	queue_destroy(colaAuxiliar);

	return loEncontre;
}
コード例 #12
0
ファイル: test.c プロジェクト: agmathiesen/OSM
void* dummycomb(void *arg){
	arg = arg;
	queue_pop(&queue, &pri);
	//sleep(1);
	queue_push(&queue, pri);
	return NULL;
}
コード例 #13
0
ファイル: lfqueue.c プロジェクト: ekkotron/actordb_driver
static void *producer(void *arg)
{
	threadinf *inf = (threadinf*)arg;
	char *op;
	int i;
	long long int me = (long long int)pthread_self();

	for (i = 0; i < ITERATIONS; i++)
	{
		// printf("PULL! %lld\n",me);
		item *it;
		qitem *qi = queue_get_item(inf->q);
		if (qi->cmd == NULL)
			qi->cmd = malloc(sizeof(item));
		it = (item*)qi->cmd;
		it->n = i;
		it->thread = inf->thread;
		queue_push(inf->q,qi);
		// if (tries > 10)
			// printf("%lld, i=%d, tries=%d, index=%d\n",me, i, tries, index);

		// if ((i % 10000) == 0)
		// 	printf("pthr=%lld, i=%d\n",me, i);
	}

	return NULL;
}
コード例 #14
0
ファイル: multilookup.c プロジェクト: entzel/Dnslookup
//Read input file function
void* ReqThreads(void* Inputfile) 
{
	char* hostname;
	hostname = malloc(SBUFSIZE*sizeof(char)); //use malloc to allocate memory
	FILE* fp = fopen(Inputfile, "r");
	
	//Read File and Process, list of text, url hostnames
	while (fscanf(fp, INPUTFS, hostname) > 0) {
		
		//If queue is full, wait and sleep
		while(queue_is_full(requesterQ)) { //busy wait
			usleep((rand()% 100)+1);
			continue;   
			} 
		
			pthread_mutex_lock(&Q_lock); //lock so only one thread can access queue
			queue_push(requesterQ, hostname); //push the hostname onto the queue
			pthread_mutex_unlock(&Q_lock); //unlock when done pushing an item

			hostname = malloc(SBUFSIZE*sizeof(char));
	}
	free(hostname); //free the space allocated with malloc
	fclose(fp); //close input file when done
	return 0;
}
コード例 #15
0
ファイル: syms.c プロジェクト: aoool/tiering
/**
 * @brief schedule_download Push file in the first priority download queue.
 *
 * @note Set errno to ENOMEM since this is the only kind of error
 *       within open-calls family that reflects system error.
 *
 * @param[in] fd File descriptor to calculate "proc-path" to be pushed to queue.
 *
 * @return  0: file has been successfully pushed to queue;
 *         -1: error happen during opening of shared memory object containing
 *             queue or queue push operation failed.
 */
int schedule_download( int fd ) {
        /* open shared memory object with queue if not already */
        pthread_once( &once_control, init_vars_once );
        if ( queue == NULL ) {
                /* error happen during mapping of queue from shared memory */
                 errno = ENOMEM;
                return -1;
        }

        char path[PROC_PID_FD_FD_PATH_MAX_LEN];
        snprintf(path,
                 PROC_PID_FD_FD_PATH_MAX_LEN,
                 PROC_PID_FD_FD_PATH_TEMPLATE,
                 (unsigned long long int)pid,
                 (unsigned long long int)fd);

        if ( queue_push( queue, path, PROC_PID_FD_FD_PATH_MAX_LEN ) == -1 ) {
                /* this is very unlikely situation with blocking
                   push operation */
                errno = ENOMEM;
                return -1;
        }

        return 0;
}
コード例 #16
0
ファイル: esqlite3_nif.c プロジェクト: chinnurtb/esqlite
static ERL_NIF_TERM
push_command(ErlNifEnv *env, esqlite_connection *conn, esqlite_command *cmd) {
    if(!queue_push(conn->commands, cmd)) 
        return make_error_tuple(env, "command_push_failed");
  
    return make_atom(env, "ok");
}
コード例 #17
0
ファイル: Planificador.c プロジェクト: julietaf/repo20132C
void seleccionarPorRoundRobin(datos_planificador_t *datosPlan) {
	if (datosPlan->personajeEnMovimiento == NULL ) {
		datosPlan->quantumCorriente = datosPlan->quatum;
		pthread_mutex_lock(datosPlan->mutexColas);
		datosPlan->personajeEnMovimiento = queue_pop(
				datosPlan->personajesListos);
		pthread_mutex_unlock(datosPlan->mutexColas);
		log_info(logFile, "Personaje %c seleccionado por RR.",
				datosPlan->personajeEnMovimiento->simbolo);
	} else if (datosPlan->quantumCorriente == 0) {
		log_info(logFile, "Personaje %c finalizo quantum.",
				datosPlan->personajeEnMovimiento->simbolo);
		pthread_mutex_lock(datosPlan->mutexColas);
		queue_push(datosPlan->personajesListos,
				datosPlan->personajeEnMovimiento);
		datosPlan->quantumCorriente = datosPlan->quatum;
		datosPlan->personajeEnMovimiento = queue_pop(
				datosPlan->personajesListos);
		pthread_mutex_unlock(datosPlan->mutexColas);
		log_info(logFile, "Personaje %c seleccionado por RR.",
				datosPlan->personajeEnMovimiento->simbolo);
	}

	enviarTurnoConcedido(datosPlan->personajeEnMovimiento);
	atenderPedidoPersonaje(datosPlan, datosPlan->personajeEnMovimiento->sockfd);
}
コード例 #18
0
ファイル: event.c プロジェクト: jollywho/nav
void queue_put_event(Queue *queue, Event event)
{
  queue_push(queue, event);
  if (!mainloop()->running) {
    uv_prepare_start(&mainloop()->event_prepare, prepare_events);
  }
}
コード例 #19
0
ファイル: service.c プロジェクト: zhoukk/service
int service_send(uint32_t handle, struct message *m) {
	struct service *s = service_grab(handle);
	if (!s) return -1;
	queue_push(s->queue, m);
	service_release(handle);
	return m->session;
}
コード例 #20
0
ファイル: pool.c プロジェクト: robbassi/memory-pool
void pool_free(void *data)
{
	struct slot *s = (struct slot *) (((char *) data) - headerlen);
	debug("FREE", "freeing slot %d from pool %d", s->index, s->size);
	struct pool *p = get_pool(s->size);
	queue_push(p->freed, (void *) s);
}
コード例 #21
0
ファイル: event.c プロジェクト: shiver/vectir2
unsigned int
event_subscribe(unsigned int event_id, ptrEventCallback callback) {
	Subscriber *subscriber;
	Subscriber *cur_sub;
	
	LOG_DEBUG("Adding new subscriber to event ID %d...", event_id);
	
	subscriber = malloc(sizeof(Subscriber));
	if (subscriber == NULL) {
		LOG_SEVERE("Could not assign new subscriber for event %d. In " \
			"sufficient memory.", event_id);
		return;
	}
	memset(subscriber, '\0', sizeof(Subscriber));
	
	subscriber->id = ++last_subscriber_id;
	subscriber->event_id = event_id;
	
	subscriber->callback = malloc(sizeof(ptrEventCallback));
	if (subscriber->callback == NULL) {
		LOG_SEVERE("Could not assign new subscriber for event %d. In " \
			"sufficient memory.", event_id);
		free(subscriber);
		return;
	}
	memcpy(subscriber->callback, callback, sizeof(ptrEventCallback));
		
	// add the subscriber to the list
	queue_push(event_subscribers, subscriber);
		
	LOG_DEBUG("Subscriber added %d", subscriber->id);
	return subscriber->id;
}
コード例 #22
0
static void
update_frame_v1(struct accuraterip_v1 *v1,
                unsigned total_pcm_frames,
                unsigned start_offset,
                unsigned end_offset,
                unsigned value)
{
    /*calculate initial checksum*/
    if ((v1->index >= start_offset) && (v1->index <= end_offset)) {
        v1->checksums[0] += (value * v1->index);
        v1->values_sum += value;
    }

    /*store the first (pcm_frame_range - 1) values in initial_values*/
    if ((v1->index >= start_offset) && (!queue_full(v1->initial_values))) {
        queue_push(v1->initial_values, value);
    }

    /*store the trailing (pcm_frame_range - 1) values in final_values*/
    if ((v1->index > end_offset) && (!queue_full(v1->final_values))) {
        queue_push(v1->final_values, value);
    }

    /*calculate incremental checksums*/
    if (v1->index > total_pcm_frames) {
        const uint32_t initial_value = queue_pop(v1->initial_values);

        const uint32_t final_value = queue_pop(v1->final_values);

        const uint32_t initial_value_product =
            (uint32_t)(start_offset - 1) * initial_value;

        const uint32_t final_value_product =
            (uint32_t)end_offset * final_value;

        v1->checksums[v1->index - total_pcm_frames] =
            v1->checksums[v1->index - total_pcm_frames - 1] +
            final_value_product -
            v1->values_sum -
            initial_value_product;

        v1->values_sum -= initial_value;
        v1->values_sum += final_value;
    }

    v1->index++;
}
コード例 #23
0
ファイル: unabto_app_adapter.c プロジェクト: nabto/unabto
/* Ask for an event handle corresponding to the given client request (in
 * ASYNC mode). The event handle must be released again using the
 * framework_release_handle function.
 * The return value is NAF_QUERY_NEW if this is the first time the client
 * request is seen (i.e. a new event handle is created). In this case
 * the buffer pointed to by handle will be assigned the new event handle.
 * Note that this handle will never be 0 (to distinguish the case when
 * calling this function in the SYNC model).
 * The return value is NAF_QUERY_QUEUED if the client request is already
 * known (and is pending to be processed). In this case the buffer pointed
 * to by handle is left unctouched.
 * The return value is NAF_QUERY_OUT_OF_RESOURCES if no more memory is
 * available for a new client request. The buffer pointed to by handle is
 * left unchanged. */
naf_query framework_event_query(const char* clientId, uint16_t reqId, naf_handle* handle)
{
    client_req_query query;
    queue_entry* entry;

    NABTO_LOG_TRACE(("APPREQ framework_event_query: client=" PRI_client_id2, CLIENT_ID_ARGS2(clientId, reqId)));

    /* First look for the request in the queue of pending requests. */
    query.clientId = clientId;
    query.reqId = reqId;
    query.found = NULL;
    queue_enum(is_client_request_cb, &query);
    if (query.found) {
        //The client request was found in the queue
        LOG_APPREQ_STATE("framework_event_query", "QUEUED", query.found);
        LOG_APPREQ_QUEUE();
        return NAF_QUERY_QUEUED;
    }

    /* Now the request was not found.
     * Reserve the next free entry in the queue. */
    entry = queue_alloc();
    if (!entry) {
        //The queue is full
        LOG_APPREQ_ERROR("framework_event_query", "OUT_OF_RESOURCES");
        LOG_APPREQ_QUEUE();
        return NAF_QUERY_OUT_OF_RESOURCES;
    }

    UNABTO_ASSERT(entry->state == APPREQ_FREE);
    if (entry->state != APPREQ_FREE) {
        //Hmmm - that's strange!. The new entry should have been free.
        if (clientId == entry->data.applicationRequest.clientId && reqId == entry->data.header.seq) {
            // - and it seems to be ourself!!
            LOG_APPREQ_STATE("framework_event_query", "QUEUED?", entry);
            LOG_APPREQ_QUEUE();
            return NAF_QUERY_QUEUED;
        }
        // The new entry belongs to someone else. The queue must be full !?
        LOG_APPREQ_ERROR("framework_event_query", "OUT_OF_RESOURCES?");
        LOG_APPREQ_QUEUE();
        return NAF_QUERY_OUT_OF_RESOURCES;
    }

    // Now we have a new request

    // Be sure we "own" the entry - advance to next free entry in the queue
    entry->state = APPREQ_WAITING;
    queue_push();

    // *handle cannot be initialized yet, as the received packet has not
    // yet been decrypted.
    // See framework_event() for initialization of handle.
    *handle = &entry->data;

    LOG_APPREQ_STATE("framework_event_query", "NEW", entry);
    LOG_APPREQ_QUEUE();
    return NAF_QUERY_NEW;
}
コード例 #24
0
ファイル: dbfunc.cpp プロジェクト: kinbei/lua-dbcache
int tb_activity_insert_db(lua_State *L) {
	tb_activity_record &record = g_dbrecord._tb_activity_record;
	sqldao dao;
	dao.sql = (char*)malloc(1000); // todo setbytes for binary data
	snprintf(dao.sql, 1000, "insert into tb_activity values (%ld, '%s');", record.activity_id, record.activity_name);
	queue_push(&g_sqlqueue, &dao);
	return 0;
}
コード例 #25
0
ファイル: queue_test.c プロジェクト: bcrafton/Data-Structures
int main(){

	char* a1 = "Brian";
	char* b1 = "Julia";
	char* c1 = "Rex";

	Queue* queue = queue_constructor();
	queue_push(a1, queue);
	queue_push(b1, queue);
	queue_push(c1, queue);
	
	assert(strcmp((char*)queue_pop(queue), a1) == 0);
	assert(strcmp((char*)queue_pop(queue), b1) == 0);
	assert(strcmp((char*)queue_pop(queue), c1) == 0);
	
	printf("test complete\n");
}
コード例 #26
0
ファイル: transaction.c プロジェクト: myungjoo/libsolv
void
transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs)
{
  Pool *pool = trans->pool;
  Solvable *s = pool->solvables + p;
  Queue *ti = &trans->transaction_info;
  Id q;
  int i;

  queue_empty(pkgs);
  if (p <= 0 || !s->repo)
    return;
  if (s->repo == pool->installed)
    {
      q = trans->transaction_installed[p - pool->installed->start];
      if (!q)
	return;
      if (q > 0)
	{
	  /* only a single obsoleting package */
	  queue_push(pkgs, q);
	  return;
	}
      /* find which packages obsolete us */
      for (i = 0; i < ti->count; i += 2)
	if (ti->elements[i + 1] == p)
	  queue_push2(pkgs, p, ti->elements[i]);
      /* sort obsoleters */
      if (pkgs->count > 2)
	solv_sort(pkgs->elements, pkgs->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool);
      for (i = 0; i < pkgs->count; i += 2)
	pkgs->elements[i / 2] = pkgs->elements[i + 1];
      queue_truncate(pkgs, pkgs->count / 2);
    }
  else
    {
      /* find the packages we obsolete */
      for (i = 0; i < ti->count; i += 2)
	{
	  if (ti->elements[i] == p)
	    queue_push(pkgs, ti->elements[i + 1]);
	  else if (pkgs->count)
	    break;
	}
    }
}
コード例 #27
0
//Encola pcb en la cola general de listos
void set_pcb_READY(PCB* pcb){
	if(queue_is_empty(READY_Process_Queue)){
		free(READY_Process_Queue);
		READY_Process_Queue = queue_create();
	}
	queue_push(READY_Process_Queue, pcb);
	log_trace(nucleo_logger, "PLANIFICACION: Proceso %d READY", pcb->processId);
}
コード例 #28
0
ファイル: semaforos.c プロジェクト: ferjjp/personalCopyTP
void blockProcess(t_queue* blockedQueue,
		t_nodo_proceso_ejecutando* procesoEjecutando)
{
	t_nodo_proceso* copia = malloc(sizeof *copia);
	memcpy(copia, &(procesoEjecutando->proceso), sizeof *copia);
	queue_push(blockedQueue, copia);
//	stopProcessing(procesoEjecutando);
}
コード例 #29
0
ファイル: Wendys.c プロジェクト: 1168392/exercises
void agregar(t_Ingredientes ingrediente) {
	printf("Agregando ingrediente %s\n", ingrediente_to_string(ingrediente));
	pthread_mutex_lock(&mutex);
	int * i = malloc(sizeof(int));
	*i = ingrediente;
	queue_push(hamburguesa.ingredientes, i);
	pthread_mutex_unlock(&mutex);
}
コード例 #30
0
ファイル: entradaSalida.c プロジェクト: ferjjp/personalCopyTP
void blockProcessIO(t_nodo_hiloIO* dispositivoIO,
		t_nodo_proceso_bloqueadoIO* nuevo)
{
	pthread_mutex_lock(&dispositivoIO->dataHilo.mutex_io);
	queue_push(dispositivoIO->dataHilo.bloqueados, nuevo);
	pthread_mutex_unlock(&dispositivoIO->dataHilo.mutex_io);
	sem_post(&dispositivoIO->dataHilo.sem_io);
}