示例#1
0
bool demo_http_server::run() {
  //here you can set worker threads count
  int thrds_count = 4;

  //go to loop
  LOG_PRINT("Run net_service loop( " << thrds_count << " threads)...",
            LOG_LEVEL_0);
  if (!m_net_server.run_server(thrds_count)) {
    LOG_ERROR("Failed to run net tcp server!");
  }

  LOG_PRINT("net_service loop stopped.", LOG_LEVEL_0);
  return true;
}
示例#2
0
// type is 0 for energy, 1 for gradient
void register_lua_function(char *plugin_function_name, LUA_FUNCTION_TYPE type)
{
    LOG_PRINT(LOG_INFO,"Registering Lua function : %s \n",plugin_function_name);
    
    if(type == POTENTIAL)
        strcpy(lua_function[POTENTIAL],plugin_function_name);
    else if(type == GRADIENT)
        strcpy(lua_function[GRADIENT],plugin_function_name);
    else
    {
        LOG_PRINT(LOG_ERROR,"Unknown type %d for register_lua_function.\n",type);
        exit(-1);
    }
}
示例#3
0
文件: logging.c 项目: jedie/XRoar
void log_hexdump_line(struct log_handle *l) {
    if (!l)
        return;
    assert(l->prefix != NULL);
    assert(l->type == LOG_HEXDUMP);
    if (l->ctx.hexdump.nbytes == 0)
        return;
    LOG_PRINT("%s: %04x  ", l->prefix, l->ctx.hexdump.address);
    unsigned i;
    for (i = 0; i < l->ctx.hexdump.nbytes; i++) {
        int f = ((i + 1) == l->ctx.hexdump.flag) ? '*' : ' ';
        LOG_PRINT("%02x%c", l->ctx.hexdump.buf[i], f);
        if (i == 8)
            LOG_PRINT(" ");
    }
    for (; i < 16; i++) {
        LOG_PRINT("   ");
        if (i == 8)
            LOG_PRINT(" ");
    }
    LOG_PRINT(" |");
    for (i = 0; i < l->ctx.hexdump.nbytes; i++) {
        int c = l->ctx.hexdump.buf[i];
        LOG_PRINT("%c", isprint(c) ? c : (int)'.');
    }
    LOG_PRINT("|\n");
    l->ctx.hexdump.address += l->ctx.hexdump.nbytes;
    l->ctx.hexdump.nbytes = 0;
    l->ctx.hexdump.flag = -1;
}
示例#4
0
文件: smime-vfy.c 项目: gitpan/smime
static PKCS7*
get_pkcs7_from_pem(const char* enc_entity)
{
  const char* p;
  char*  wrapped_enc_entity = NULL;
  BIO*   rbio = NULL;
  PKCS7* p7 = NULL;
 
  /* Check if encrypted entity is composed of raw data or if it has some
   * headers. In the latter case, just skip the headers. Headers are
   * separated from data by an empty line (hence sequence CRLF CRLF).*/
  
  if (p = strstr(enc_entity, CRLF CRLF)) {
    enc_entity = p+4;
  } else if (p = strstr(enc_entity, LF LF)) {
    enc_entity = p+2;
  } else if (p = strstr(enc_entity, CR CR)) {
    enc_entity = p+2;
  }
  
  /* Make sure the pem markers are there */
  
  LOG_PRINT("get_pkcs7_from_pem: wrapping in pem markers");

  if (!(wrapped_enc_entity = wrap_in_pem_markers(enc_entity, "PKCS7")))
    GOTO_ERR("no memory?");
  LOG_PRINT("get_pkcs7_from_pem: wrapped.");
  
  /* Set up BIO so encrypted/signed data can be read from pem file */
  
  if (!(rbio = set_read_BIO_from_buf(wrapped_enc_entity, -1))) goto err;
  
  LOG_PRINT("get_pkcs7_from_pem: ready to read PKCS7 bio...");

  /* Load the PKCS7 object from a pem file to internal representation.
   * this reads all of the data file. */
  
  if (!(p7=PEM_read_bio_PKCS7(rbio,NULL/*&x*/,NULL/*callback*/,NULL/*arg*/)))
    GOTO_ERR("11 corrupt PEM PKCS7 file? (PEM_read_bio_PKCS7)");

  LOG_PRINT("get_pkcs7_from_pem: bio read");

  BIO_free_all(rbio);
  Free(wrapped_enc_entity);
  return p7;
err:
  if (rbio) BIO_free_all(rbio);
  if (wrapped_enc_entity) Free(wrapped_enc_entity);
  return NULL;
}
示例#5
0
void alarms_history::on_comboBoxLevel_currentIndexChanged(int index)
{
    LOG_PRINT(info_e, "_level %d\n", _level);
    /* 0 is all level */
    if (_level != index && index < nb_of_level_e)
    {
        _level = index;
        LOG_PRINT(info_e, "_level %d\n", _level);
        if (_file_nb == 0) return;
        if (loadLogFile(_current, _alarm, _event, _level) == false)
        {
            LOG_PRINT(error_e, "Cannot open log file %d\n", _current);
        }
    }
}
示例#6
0
    void Acceptor::listen()
    {
        socket_t fd = SocketOps::createSocket();

        if(fd < 0)
        {
            LOG_PRINT(LogType_Fatal, "create socket failed:%s %s:%d",
                      GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
            return;
        }

        if(!SocketOps::bindSocket(fd, &listenAddr_.getSockAddr()))
        {
            LOG_PRINT(LogType_Fatal, "bind socket failed:%s %s:%d",
                      GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
            goto err;
        }

        if(!SocketOps::listen(fd))
        {
            LOG_PRINT(LogType_Fatal, "listen socket failed:%s %s:%d",
                      GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
            goto err;
        }

        if(!SocketOps::setSocketNoneBlocking(fd))
        {
            LOG_PRINT(LogType_Fatal, "enable socket noneBlocking failed:%s %s:%d",
                      GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
            goto err;
        }

        LOG_PRINT(LogType_Info, "Acceptor listen at ip:%s port:%u", listenAddr_.ip().c_str(),
                  listenAddr_.port());

        listenFd_ = fd;
        acceptChannelPtr_ = std::make_shared<Channel>(loop_, listenFd_);
        acceptChannelPtr_->setReadCallback(std::bind(&Acceptor::handleRead, this));
        acceptChannelPtr_->setOwner(shared_from_this());
        acceptChannelPtr_->enableReading();
        listenning_ = true;

        return;

err:
        SocketOps::closeSocket(fd);
        return;
    }
示例#7
0
/*
*************************
Stops measuring the time
*************************
*/
void DebugApi::Stop ()
{
	unsigned long mElapsedTime = mTime - timeGetTime();
	if (mElapsedTime < 0) mElapsedTime = 0;
	mElapsedTime = mElapsedTime * (unsigned long) 0.001f;
	LOG_PRINT(" %d\n",  mElapsedTime);
}
示例#8
0
/*
*************************
Writes a signal (for debugging purposes)
*************************
*/
void DebugApi::BreakPoint ()
{
	if (!mOk) return;

	LOG_PRINT("Abracadabra\n");
	
}
示例#9
0
文件: video.c 项目: taktod/ttLibC
/**
 * make clone frame.
 * always make copy buffer on it.
 * @param prev_frame reuse frame object.
 * @param src_frame  source of clone.
 */
ttLibC_Video *ttLibC_Video_clone(
		ttLibC_Video *prev_frame,
		ttLibC_Video *src_frame) {
	if(src_frame == NULL) {
		return NULL;
	}
	switch(src_frame->inherit_super.type) {
//	case frameType_bgr:
	case frameType_flv1:
		return (ttLibC_Video *)ttLibC_Flv1_clone(
				(ttLibC_Flv1 *)prev_frame,
				(ttLibC_Flv1 *)src_frame);
	case frameType_h264:
		return (ttLibC_Video *)ttLibC_H264_clone(
 				(ttLibC_H264 *)prev_frame,
				(ttLibC_H264 *)src_frame);
//	case frameType_h265:
//	case frameType_theora:
//	case frameType_vp6:
//	case frameType_vp8:
//	case frameType_vp9:
//	case frameType_wmv1:
//	case frameType_wmv2:
//	case frameType_yuv420:
	default:
		LOG_PRINT("no clone function, frame type:%d", src_frame->inherit_super.type);
		return NULL;
	}
}
示例#10
0
文件: zutil.c 项目: Chenxofhit/zimg
/**
 * @brief mk_dirs It creates a multi-level directory like ./img/330/28/557.
 *
 * @param dir The path of a multi-level directory.
 *
 * @return  1 for success and -1 for fail.
 */
int mk_dirs(const char *dir)
{
    char tmp[512];
    char *p;
    if (strlen(dir) == 0 || dir == NULL) 
    {
        LOG_PRINT(LOG_WARNING, "strlen(dir) is 0 or dir is NULL.");
        return -1;
    }
    memset(tmp, 0, sizeof(tmp));
    strncpy(tmp, dir, strlen(dir));
    if (tmp[0] == '/' && tmp[1]== '/') 
        p = strchr(tmp + 2, '/'); 
    else 
        p = strchr(tmp, '/');
    if (p) 
    {
        *p = '\0';
        mkdir(tmp,0777);
        chdir(tmp);
    } 
    else 
    {
        mkdir(tmp,0777);
        chdir(tmp);
        return 1;
    }
    mk_dirs(p + 1);
    return 1;
}
示例#11
0
文件: zutil.c 项目: Chenxofhit/zimg
/**
 * @brief is_dir Check a path is a directory.
 *
 * @param path The path input.
 *
 * @return 1 for yes and -1 for no.
 */
int is_dir(const char *path)
{
    struct stat st;
    if(stat(path, &st)<0)
    {
        LOG_PRINT(LOG_WARNING, "Path[%s] is Not Existed!", path);
        return -1;
    }
    if(S_ISDIR(st.st_mode))
    {
        LOG_PRINT(LOG_INFO, "Path[%s] is A Dir.", path);
        return 1;
    }
    else
        return -1;
}
示例#12
0
//buffern len is the number of pointers we want allocate, the ptr size is the maximum size of each ptr.
ring_t*
rb_new(uint32_t buffer_len)
{   
    ring_t * rb;
    rb = (ring_t*)malloc(sizeof(ring_t));
    if (!rb)
        return NULL;

    LOG_PRINT("\nRing buffer is being created with the size %d.", buffer_len);

    rb->size = buffer_len;

    rb->buffer_start = (uint8_t*)malloc(rb->size * sizeof *rb->buffer_start);
        memset(rb->buffer_start, 0, rb->size);
    
    rb->buffer_end =  (rb->buffer_start + (rb->size ) );
    rb->write_calls = 0;
    rb->read_calls = 0;
    rb->head = rb->buffer_start;
    rb->tail =  rb->buffer_end;
           
    rb->round_complete = 0;
    
    return rb;
}
示例#13
0
void MainState::Update() {
	// Moves the player in the specified direction
	if (m_PlayerDirState[kPlayerDirLeft]) {
		m_Player->TranslateBy(Vec2(-5.0, 0.0));
	}
	else if (m_PlayerDirState[kPlayerDirRight]) {
		m_Player->TranslateBy(Vec2(5.0, 0.0));
	}
	else if (m_PlayerDirState[kPlayerDirUp]) {
		m_Player->TranslateBy(Vec2(0.0, -5.0));
	}
	else if (m_PlayerDirState[kPlayerDirDown]) {
		m_Player->TranslateBy(Vec2(0.0, 5.0));
	}

	for (int i = 0; i < m_ProjectileArray.GetSize(); ++i) {
		Rect screenRect = m_EnginePtr->GetScene()->GetScreenRect();

		Projectile* projectile = m_ProjectileArray[i];

		Vec2 pos = projectile->GetWorldPosition();

		if (pos.GetX() < screenRect.GetX() ||
			pos.GetX() > (screenRect.GetX() + screenRect.GetW()) ||
			pos.GetY() < screenRect.GetY() ||
			pos.GetY() > (screenRect.GetY() + screenRect.GetH())) {

			LOG_PRINT("removed");
		}
	}
}
示例#14
0
static int
event_unregister_poll (struct event_pool *event_pool, int fd, int idx_hint)
{
        int idx = -1;

        GF_VALIDATE_OR_GOTO ("event", event_pool, out);

        pthread_mutex_lock (&event_pool->mutex);
        {
                idx = __event_getindex (event_pool, fd, idx_hint);

                if (idx == -1) {
                        LOG_PRINT(D_LOG_ERR,
                                "index not found for fd=%d (idx_hint=%d)",
                                fd, idx_hint);
                        errno = ENOENT;
                        goto unlock;
                }

                event_pool->reg[idx] =  event_pool->reg[--event_pool->used];
                event_pool->changed = 1;
        }
unlock:
        pthread_mutex_unlock (&event_pool->mutex);

out:
        return idx;
}
示例#15
0
inline BaseEntity *EntityManager::GetBaseEntity( BaseEntityHandle& rBaseEntityHandle )
{
	BaseEntity *pBaseEntity = NULL;
	if( rBaseEntityHandle.GetBaseEntityPointer() )
	{
		// already loaded
		pBaseEntity = rBaseEntityHandle.GetBaseEntityPointer();
	}
	else if( rBaseEntityHandle.GetState() == BaseEntityHandle::STATE_INVALID )
	{
		// invalid base entity handle
		// - already tried to load the base entity before but it was not found in the database
		return NULL;
	}
	else // i.e. rBaseEntityHandle.GetState() == BaseEntityHandle::STATE_UNINITIALIZED
	{
		// get pointer to the base entity
		// if the base entity has not been loaded yet, load it
		if( LoadBaseEntity( rBaseEntityHandle ) )
		{
			pBaseEntity = rBaseEntityHandle.GetBaseEntityPointer();
		}
		else
		{
			LOG_PRINT( " - unable to create a copy entity (base entity: " + string(rBaseEntityHandle.GetBaseEntityName()) + ")" );
			return NULL;
		}
	}

	return pBaseEntity;
}
示例#16
0
文件: rtc_qos.c 项目: KHATEEBNSIT/AP
GOS_ERROR_CODE RTC_XML_CFG_QosIpv4Cfg(BOOL bSrcApp)
{
    RG_QOS_IPV4_CFG_T msg;

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

    //Get Data from XML
    RTC_XML_GET_QosIpv4Cfg(&msg);

    LOG_PRINT(gRtcLogId1, LOG_LEVEL_NORMAL,
        "***QOS CFG*** "
        "enable:%d "
        "us_rate:%d "
        "count:%d ",
        msg.enable, msg.us_rate, msg.count
    );

    //Send sync Msg to NET
    RTC_SendSyncMsg("RG_MSG_CFG_QOS_IPV4_SET", PON_APPLID_NET, RG_MSG_CFG_QOS_IPV4_SET, &msg, sizeof(msg));

    if (SRCAPP_WEB == bSrcApp && RTC_IsTr069MgrReady())
    {
        //Send Msg to TR069
       VOS_SendMsg(PON_APPLID_TR069_MIB, RG_MSG_CFG_QOS_IPV4_SET, VOS_MSG_PRI_NORMAL, &msg, sizeof(msg));
    }

    return GOS_OK;
}
示例#17
0
    void TcpServer::newConnection(int sockfd, const InetAddress& peerAddr)
    {
        loop_->assertInLoopThread();
        EventLoop* ioLoop = threadPool_->getNextLoop();
        char buf[64];
        snprintf(buf, sizeof buf, "-%s#%d", ipPort_.c_str(), nextConnId_);
        ++nextConnId_;
        std::string connName = name_ + buf;

        LOG_PRINT(LogType_Info, "TcpServer::newConnection [%s] - new connection [%s] from %s",
                  name_.c_str(), connName.c_str(), peerAddr.toIpPort().c_str());
        InetAddress localAddr(SocketOps::getLocalAddr(sockfd));
        // FIXME poll with zero timeout to double confirm the new connection
        // FIXME use make_shared if necessary
        TcpConnectionPtr conn(new TcpConnection(ioLoop,
                                                connName,
                                                sockfd,
                                                localAddr,
                                                peerAddr));
        connections_[connName] = conn;
        conn->setConnectionCallback(connectionCallback_);
        conn->setMessageCallback(messageCallback_);
        conn->setWriteCompleteCallback(writeCompleteCallback_);
        conn->setCloseCallback(
            std::bind(&TcpServer::removeConnection, this, std::placeholders::_1)); // FIXME: unsafe
        ioLoop->runInLoop(std::bind(&TcpConnection::connectEstablished, conn));
    }
void ScheduleGraph::updateTask(TaskGraph::Node task, size_t delta) {
   vector<TaskGraph::Node> triggeredTasks;
   {
      // Update dependency
      int64_t previous=taskValues[task].fetch_add(delta);
      int64_t current=previous+delta;
      assert(current>=0);
      if(current==0) {
         LOG_PRINT("[ScheduleGraph] Finished task node "<<TaskGraph::getName(task));
         // Check if edge can be activated
         auto& nextTasks = targets[task];
         for (auto itr = nextTasks.begin(); itr != nextTasks.end(); ++itr) {
            const auto& nextTask = *itr;
            if(!triggered[nextTask].load()) {
               bool trigger=true;
               auto& dependencies=sources[nextTask];
               for (auto dependency = dependencies.begin(); dependency != dependencies.end(); ++dependency) {
                  if(taskValues[*dependency].load() != 0) {
                     trigger=false;
                  }
               }

               // Compare and exchange will only work for one task
               if(trigger && !triggered[nextTask].fetch_or(1)) {
                  triggeredTasks.push_back(nextTask);
               }
            }
         }
      }
   }

   for (auto task = triggeredTasks.begin(); task != triggeredTasks.end(); ++task) {
      runTask(*task);
   }
}
示例#19
0
static void process_signal(int sig){
	int r = 0;

	switch(sig) {
	case SIGINT:
	case SIGQUIT:
	case SIGTERM:
	case SIGHUP:
		r += log_status();
		break;
	case SIGUSR1:
	case SIGUSR2:
		log_debug();
		/*local_debug();*/
		cluster_debug();
		return;
	default:
		LOG_PRINT("Unknown signal received... ignoring");
		return;
	}

	if (!r) {
		LOG_DBG("No current cluster logs... safe to exit.");
		cleanup_all();
		exit(EXIT_SUCCESS);
	}

	LOG_ERROR("Cluster logs exist.  Refusing to exit.");
}
示例#20
0
文件: zlscale.c 项目: 734839030/zimg
static int zimg_type(lua_State *L)
{
    lua_arg *larg = pthread_getspecific(thread_key);
    lua_pushstring(L, larg->trans_type);
    LOG_PRINT(LOG_DEBUG, "zimg_type: %s", larg->trans_type);
    return 1;
}
示例#21
0
文件: zlscale.c 项目: 734839030/zimg
static int lua_log_print(lua_State *L)
{
    int log_level = lua_tonumber(L, 1);
    const char *log_str = lua_tostring(L, 2);
    LOG_PRINT(log_level, "zimg_lua: %s", log_str);
    return 0;
}
void scheduleQueries(TaskGraph::Node taskId, uint32_t queryType, Scheduler& scheduler, ScheduleGraph& taskGraph, queryfiles::QueryBatcher& batches,
   runtime::QueryState& queryState, bool logScheduling) {
      // Schedule query tasks
      TaskGroup queryTasks;
      unsigned count=0;
      auto taskBatches=batches.getBatches(queryType);
      for(auto batchIter=taskBatches.begin(); batchIter!=taskBatches.end(); batchIter++) {
         queryfiles::QueryBatch* batch = *batchIter;
         assert(batch->queryType==queryType);

         queryTasks.schedule(LambdaRunner::createLambdaTask(RunBatch(scheduler, taskGraph, taskId, queryState, batch), taskId));
         count++;
      }

      queryTasks.join(LambdaRunner::createLambdaTask(UpdateTask(taskGraph, taskId),taskId));

      if(logScheduling) {
      	assert(batches.batchCounts[queryType]==count);
      	LOG_PRINT("[Queries] Schedule " << count << " of type: "<< queryType);
      }

      // Disable early close
      taskGraph.updateTask(taskId, 1);
      if(taskId==TaskGraph::Query1) {
         scheduler.schedule(queryTasks.close(), Priorities::LOW, false);
      } else {
         scheduler.schedule(queryTasks.close(), Priorities::CRITICAL, false);
      }
}
示例#23
0
文件: zlscale.c 项目: 734839030/zimg
static int gray_wi(lua_State *L) {
    lua_arg *larg = pthread_getspecific(thread_key);
    int ret = MagickSetImageType(larg->img, GrayscaleType);
    LOG_PRINT(LOG_DEBUG, "gray_wi: ret = %d", ret);
    lua_pushnumber(L, ret);
    return 1;
}
示例#24
0
文件: zhttpd.c 项目: 734839030/zimg
/**
 * @brief dump_request_cb The callback of a dump request.
 *
 * @param req The request you want to dump.
 * @param arg It is not useful.
 */
void dump_request_cb(evhtp_request_t *req, void *arg)
{
    const char *uri = req->uri->path->full;

	//switch (evhtp_request_t_get_command(req)) {
    int req_method = evhtp_request_get_method(req);
    if(req_method >= 16)
        req_method = 16;

	LOG_PRINT(LOG_DEBUG, "Received a %s request for %s", method_strmap[req_method], uri);
    evbuffer_add_printf(req->buffer_out, "uri : %s\r\n", uri);
    evbuffer_add_printf(req->buffer_out, "query : %s\r\n", req->uri->query_raw);
    evhtp_headers_for_each(req->uri->query, print_headers, req->buffer_out);
    evbuffer_add_printf(req->buffer_out, "Method : %s\n", method_strmap[req_method]);
    evhtp_headers_for_each(req->headers_in, print_headers, req->buffer_out);

	evbuf_t *buf = req->buffer_in;;
	puts("Input data: <<<");
	while (evbuffer_get_length(buf)) {
		int n;
		char cbuf[128];
		n = evbuffer_remove(buf, cbuf, sizeof(buf)-1);
		if (n > 0)
			(void) fwrite(cbuf, 1, n, stdout);
	}
	puts(">>>");

    evhtp_headers_add_header(req->headers_out, evhtp_header_new("Server", settings.server_name, 0, 1));
    evhtp_headers_add_header(req->headers_out, evhtp_header_new("Content-Type", "text/plain", 0, 0));
    evhtp_send_reply(req, EVHTP_RES_OK);
}
示例#25
0
文件: zhttpd.c 项目: 734839030/zimg
/**
* @brief add_info Added image info to the request
*
* @param im The image struct
* @param req The evhtp request
*/
void add_info(MagickWand *im, evhtp_request_t *req)
{
    MagickSizeType size = MagickGetImageSize(im);
    unsigned long width = MagickGetImageWidth(im);
    unsigned long height = MagickGetImageHeight(im);
    size_t quality = MagickGetImageCompressionQuality(im);
    quality = (quality == 0 ? 100 : quality);
    char *format = MagickGetImageFormat(im);

    //{"ret":true,"info":{"size":195135,"width":720,"height":480,"quality":75,"format":"JPEG"}}
    cJSON *j_ret = cJSON_CreateObject();
    cJSON *j_ret_info = cJSON_CreateObject();
    cJSON_AddBoolToObject(j_ret, "ret", 1);
    cJSON_AddNumberToObject(j_ret_info, "size", size);
    cJSON_AddNumberToObject(j_ret_info, "width", width);
    cJSON_AddNumberToObject(j_ret_info, "height", height);
    cJSON_AddNumberToObject(j_ret_info, "quality", quality);
    cJSON_AddStringToObject(j_ret_info, "format", format);
    cJSON_AddItemToObject(j_ret, "info", j_ret_info);
    char *ret_str_unformat = cJSON_PrintUnformatted(j_ret);
    LOG_PRINT(LOG_DEBUG, "ret_str_unformat: %s", ret_str_unformat);
    evbuffer_add_printf(req->buffer_out, "%s", ret_str_unformat);
    cJSON_Delete(j_ret);
    free(ret_str_unformat);
    free(format);
}
示例#26
0
static int
event_select_on_poll (struct event_pool *event_pool, int fd, int idx_hint,
                      int poll_in, int poll_out)
{
        int idx = -1;

        GF_VALIDATE_OR_GOTO ("event", event_pool, out);

        pthread_mutex_lock (&event_pool->mutex);
        {
                idx = __event_getindex (event_pool, fd, idx_hint);

                if (idx == -1) {
                        LOG_PRINT(D_LOG_ERR,
                                "index not found for fd=%d (idx_hint=%d)",
                                fd, idx_hint);
                        errno = ENOENT;
                        goto unlock;
                }

                switch (poll_in) {
                case 1:
                        event_pool->reg[idx].events |= POLLIN;
                        break;
                case 0:
                        event_pool->reg[idx].events &= ~POLLIN;
                        break;
                case -1:
                        /* do nothing */
                        break;
                default:
                        /* TODO: log error */
                        break;
                }

                switch (poll_out) {
                case 1:
                        event_pool->reg[idx].events |= POLLOUT;
                        break;
                case 0:
                        event_pool->reg[idx].events &= ~POLLOUT;
                        break;
                case -1:
                        /* do nothing */
                        break;
                default:
                        /* TODO: log error */
                        break;
                }

                if (poll_in + poll_out > -2)
                        event_pool->changed = 1;
        }
unlock:
        pthread_mutex_unlock (&event_pool->mutex);

out:
        return idx;
}
void ScheduleGraph::runTask(TaskGraph::Node task) {
   LOG_PRINT("[ScheduleGraph] Scheduling task node "<<TaskGraph::getName(task));
   auto fn=taskFunction[task];
   taskFunction[task]=nullptr;

   ScheduleGraphRunner* taskRunner=new ScheduleGraphRunner(task, fn, *this);
   scheduler.schedule(schedulerTask(taskRunner,task), taskPriority[task]);
}
示例#28
0
文件: zlscale.c 项目: 734839030/zimg
static int get_wi_format(lua_State *L) {
    lua_arg *larg = pthread_getspecific(thread_key);
    char *format = MagickGetImageFormat(larg->img);
    LOG_PRINT(LOG_DEBUG, "get_wi_format: %s", format);
    lua_pushstring(L, format);
    free(format);
    return 1;
}
示例#29
0
文件: zhttpd.c 项目: 734839030/zimg
int on_header_field(multipart_parser* p, const char *at, size_t length)
{
    char *header_name = (char *)malloc(length+1);
    snprintf(header_name, length+1, "%s", at);
    LOG_PRINT(LOG_DEBUG, "header_name %d %s: ", length, header_name);
    free(header_name);
    return 0;
}
示例#30
0
void alarms_history::on_comboBoxDate_currentIndexChanged(int index)
{
    _current = index;
    if (loadLogFile(_current, _alarm, _event, _level) == false)
    {
        LOG_PRINT(error_e, "Cannot open log file %d\n", _current);
    }
}