当前位置: 首页>>代码示例>>C++>>正文


C++ process_events函数代码示例

本文整理汇总了C++中process_events函数的典型用法代码示例。如果您正苦于以下问题:C++ process_events函数的具体用法?C++ process_events怎么用?C++ process_events使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了process_events函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: X11DRV_MsgWaitForMultipleObjectsEx

/***********************************************************************
 *           MsgWaitForMultipleObjectsEx   ([email protected])
 */
DWORD X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
                                          DWORD timeout, DWORD mask, DWORD flags )
{
    DWORD i, ret;
    struct x11drv_thread_data *data = TlsGetValue( thread_data_tls_index );

    if (!data || data->process_event_count)
    {
        if (!count && !timeout) return WAIT_TIMEOUT;
        return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
                                         timeout, flags & MWMO_ALERTABLE );
    }

    /* check whether only server queue handle was passed in */
    if (count < 2) flags &= ~MWMO_WAITALL;

    data->process_event_count++;

    if (process_events( data->display, mask )) ret = count;
    else if (count || timeout)
    {
        HANDLE new_handles[MAXIMUM_WAIT_OBJECTS+1];  /* FIXME! */

        for (i = 0; i < count; i++) new_handles[i] = handles[i];
        new_handles[count] = data->display_fd;

        ret = WaitForMultipleObjectsEx( count+1, new_handles, flags & MWMO_WAITALL,
                                        timeout, flags & MWMO_ALERTABLE );
        if (ret == count) process_events( data->display, mask );
    }
    else ret = WAIT_TIMEOUT;

    data->process_event_count--;
    return ret;
}
开发者ID:howard5888,项目名称:wineT,代码行数:38,代码来源:event.c

示例2: macdrv_MsgWaitForMultipleObjectsEx

/***********************************************************************
 *              MsgWaitForMultipleObjectsEx   ([email protected])
 */
DWORD CDECL macdrv_MsgWaitForMultipleObjectsEx(DWORD count, const HANDLE *handles,
                                               DWORD timeout, DWORD mask, DWORD flags)
{
    DWORD ret;
    struct macdrv_thread_data *data = macdrv_thread_data();
    macdrv_event_mask event_mask = get_event_mask(mask);

    TRACE("count %d, handles %p, timeout %u, mask %x, flags %x\n", count,
          handles, timeout, mask, flags);

    if (!data)
    {
        if (!count && !timeout) return WAIT_TIMEOUT;
        return WaitForMultipleObjectsEx(count, handles, flags & MWMO_WAITALL,
                                        timeout, flags & MWMO_ALERTABLE);
    }

    if (data->current_event && data->current_event->type != QUERY_EVENT &&
        data->current_event->type != QUERY_EVENT_NO_PREEMPT_WAIT &&
        data->current_event->type != APP_QUIT_REQUESTED &&
        data->current_event->type != WINDOW_DRAG_BEGIN)
        event_mask = 0;  /* don't process nested events */

    if (process_events(data->queue, event_mask)) ret = count - 1;
    else if (count || timeout)
    {
        ret = WaitForMultipleObjectsEx(count, handles, flags & MWMO_WAITALL,
                                       timeout, flags & MWMO_ALERTABLE);
        if (ret == count - 1) process_events(data->queue, event_mask);
    }
    else ret = WAIT_TIMEOUT;

    return ret;
}
开发者ID:AndreRH,项目名称:wine,代码行数:37,代码来源:event.c

示例3: ble_do_events

void ble_do_events()
{
        spi_old = SPCR;
        SPI.setBitOrder(LSBFIRST);
        SPI.setClockDivider(SPI_CLOCK_DIV8);
        SPI.setDataMode(SPI_MODE0);

	if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX))
	{
		if(tx_buffer_len > 0)
		{	
			unsigned char Index = 0;
			while(tx_buffer_len > 20)
			{
				if(true == lib_aci_send_data(PIPE_UART_OVER_BTLE_UART_TX_TX, &tx_buff[Index], 20))
				{
					Serial.print("data transmmit success!  Length: ");
					Serial.print(20, DEC);
					Serial.print("    ");
				}
				else
				{
					Serial.println("data transmmit fail !");
				}
				tx_buffer_len -= 20;
				Index += 20;
				aci_state.data_credit_available--;
				Serial.print("Data Credit available: ");
				Serial.println(aci_state.data_credit_available,DEC);
				ack = 0;
				while (!ack)
					process_events();
			}

			if(true == lib_aci_send_data(PIPE_UART_OVER_BTLE_UART_TX_TX,& tx_buff[Index], tx_buffer_len))
			{
				Serial.print("data transmmit success!  Length: ");
				Serial.print(tx_buffer_len, DEC);
				Serial.print("    ");
			}
			else
			{
				Serial.println("data transmmit fail !");
			}
			tx_buffer_len = 0;
			aci_state.data_credit_available--;
			Serial.print("Data Credit available: ");
			Serial.println(aci_state.data_credit_available,DEC);
			ack = 0;
			while (!ack)
				process_events();
		}
	}

	process_events();

	SPCR = spi_old;
}
开发者ID:hellprototypes,项目名称:BLEShield,代码行数:58,代码来源:ble_shield.cpp

示例4: event_thread

static void*
event_thread(void *data)
{
    QUEUE* event_q = (QUEUE*) data;
    parrot_event* event;
    QUEUE_ENTRY *entry;
    int running = 1;

    LOCK(event_q->queue_mutex);
    /*
     * we might already have an event in the queue
     */
    if (peek_entry(event_q))
        running = process_events(event_q);
    while (running) {
        entry = peek_entry(event_q);
        if (!entry) {
            /* wait infinite until entry arrives */
            queue_wait(event_q);
        }
        else if (entry->type == QUEUE_ENTRY_TYPE_TIMED_EVENT) {
            /* do a_timedwait for entry */
            struct timespec abs_time;
            FLOATVAL when;
            event = (parrot_event* )entry->data;
            when = event->u.timer_event.abs_time;
            abs_time.tv_sec = (time_t) when;
            abs_time.tv_nsec = (when - abs_time.tv_sec) *
                (1000L*1000L*1000L);
            queue_timedwait(event_q, &abs_time);
        }
        else {
            /* we shouldn't get here probably
             */
            internal_exception(1, "Spurious event");

        }
        /*
         * one or more entries arrived - we hold the mutex again
         * so we have to use the nonsync_pop_entry to pop off event entries
         */
        running = process_events(event_q);
    } /* event loop */
    /*
     * the main interpreter is dying
     * TODO empty the queue
     */
    UNLOCK(event_q->queue_mutex);
    queue_destroy(event_q);
    stop_io_thread();
    edebug((stderr, "event thread stopped\n"));
    return NULL;
}
开发者ID:gitpan,项目名称:ponie,代码行数:53,代码来源:events.c

示例5: ble_do_events

void ble_do_events()
{
			if (lib_aci_is_pipe_available(&aci_state, PIPE_UART_OVER_BTLE_UART_TX_TX))
			{
				if(tx_buffer_len > 0)
				{	
					unsigned char Index = 0;
					while(tx_buffer_len > 20)
					{
						if(true == lib_aci_send_data(PIPE_UART_OVER_BTLE_UART_TX_TX, &tx_buff[Index], 20))
						{
							Serial.print("data transmmit success!  Length: ");
							Serial.print(20, DEC);
							Serial.print("    ");
						}
						else
						{
							Serial.println("data transmmit fail !");
						}
						tx_buffer_len -= 20;
						Index += 20;
						aci_state.data_credit_available--;
						Serial.print("Data Credit available: ");
						Serial.println(aci_state.data_credit_available,DEC);
						ack = 0;
						while (!ack)
							process_events();
					}

						if(true == lib_aci_send_data(PIPE_UART_OVER_BTLE_UART_TX_TX,& tx_buff[Index], tx_buffer_len))
						{
							Serial.print("data transmmit success!  Length: ");
							Serial.print(tx_buffer_len, DEC);
							Serial.print("    ");
						}
						else
						{
							Serial.println("data transmmit fail !");
						}
						tx_buffer_len = 0;
						aci_state.data_credit_available--;
						Serial.print("Data Credit available: ");
						Serial.println(aci_state.data_credit_available,DEC);
						ack = 0;
						while (!ack)
							process_events();
				}
			}
			process_events();
}
开发者ID:shreedee,项目名称:blebridge,代码行数:50,代码来源:ble_shield.cpp

示例6: gfx_get_key

/* XoXus: FIXME: Should get_keypress block? */
static int gfx_get_key ()
{
	UINT16 k;

	process_events ();
	while (key_value == 0) {
		process_events ();
	}

	k = key_value;
	key_value= 0;

	return k;
}
开发者ID:SimonKagstrom,项目名称:sarien-j2me,代码行数:15,代码来源:svgalib.c

示例7: process_events

static ERL_NIF_TERM process_events(ErlNifEnv* env, events_t **events,
				   yaml_parser_t *parser, int flags)
{
    ERL_NIF_TERM els, el;
    yaml_event_t *event;
    els = enif_make_list(env, 0);

    if (events) {
	while (*events) {
	    event = hd(events);
	    if (event) {
		switch (event->type) {
		case YAML_SEQUENCE_END_EVENT:
		    el = process_events(env, events, parser, flags);
		    els = enif_make_list_cell(env, el, els);
		    break;
		case YAML_MAPPING_END_EVENT:
		    el = process_events(env, events, parser, flags);
		    els = enif_make_list_cell(env, el, els);
		    break;
		case YAML_MAPPING_START_EVENT:
		    yaml_event_delete(event);
		    enif_free(event);
		    return zip(env, els);
		case YAML_SEQUENCE_START_EVENT:
		    yaml_event_delete(event);
		    enif_free(event);
		    return els;
		case YAML_SCALAR_EVENT:
		    el = make_scalar(env, event, flags);
		    els = enif_make_list_cell(env, el, els);
		    break;
		case YAML_ALIAS_EVENT:
		    el = make_alias(env, event);
		    els = enif_make_list_cell(env, el, els);
		    break;
		default:
		    break;
		}
		yaml_event_delete(event);
		enif_free(event);
	    } else {
		break;
	    }
	}
    }

    return els;
}
开发者ID:jabber-at,项目名称:p1_yaml,代码行数:49,代码来源:fast_yaml.c

示例8: main

int main()
{
  int retcode;
  retcode=SDL_Init(SDL_INIT_VIDEO);
  if(-1==retcode)
    {
      std::cerr << "sdlInitFailed: " << SDL_GetError() << std::endl;
      return retcode;
    }

  if(!init_sdl_context() )
    {
      SDL_Quit();
      return -1;
    }

  if(!init_gl())
    {
      SDL_Quit();
      return -1;
    }

  init_music();

  while(true)
    {
      process_events();
      render_gl();
    }
  terminate_music();
  terminate_gl();
  SDL_Quit();

  return 0;
}
开发者ID:01d55,项目名称:UnitTestris,代码行数:35,代码来源:main_sdl.cpp

示例9: process_time_functions

/******************************************************************************
 *                                                                            *
 * Function: process_time_functions                                           *
 *                                                                            *
 * Purpose: re-calculate and update values of time-driven functions           *
 *                                                                            *
 * Author: Alexei Vladishev, Aleksandrs Saveljevs                             *
 *                                                                            *
 ******************************************************************************/
static void	process_time_functions(int *triggers_count, int *events_count)
{
	const char		*__function_name = "process_time_functions";
	DC_TRIGGER		*trigger_info = NULL;
	zbx_vector_ptr_t	trigger_order;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

	zbx_vector_ptr_create(&trigger_order);

	DCconfig_get_time_based_triggers(&trigger_info, &trigger_order, process_num, triggers_count);

	if (0 == trigger_order.values_num)
		goto clean;

	evaluate_expressions(&trigger_order);

	DBbegin();

	process_triggers(&trigger_order);

	DCfree_triggers(&trigger_order);

	*events_count = process_events();

	DBcommit();
clean:
	zbx_free(trigger_info);
	zbx_vector_ptr_destroy(&trigger_order);

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
}
开发者ID:Metalaria,项目名称:Zabbix_,代码行数:41,代码来源:timer.c

示例10: main

int main( int argc, char* argv[] )
{
  if (argc > 1) {
    cout << "Retro Quake2 Model - W.P. van Paassen - 2002" << endl;
    return -1;
  }
  
  TDEC_init_video();

  SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
  SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
  SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
  
  if (!TDEC_set_video_GL(SCREEN_WIDTH, SCREEN_HEIGHT, 16, SDL_DOUBLEBUF | SDL_HWACCEL | SDL_HWSURFACE | SDL_HWPALETTE  
			 /*| SDL_FULLSCREEN*/))
    quit(1);
  
  TDEC_init_timer();
  
  SDL_WM_SetCaption("Retro Quake2 Model effect ", "");
  
  WP_Init* wpcg = new WP_Init(argc, argv);
  wpcg->vSetViewPort(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);	
  init();

  Uint32 ntime, time = SDL_GetTicks();
  Uint32 next = SDL_GetTicks() + TICK_INTERVAL; 

  /* time based demo loop */
  while( 1 ) 
    {
     if ((ntime = SDL_GetTicks()) < next)
     {
	     draw_screen();
	     if (ntime - time >= 1000)
	     {
		     rfps = fps;//(Uint32)(((float)fps / (ntime - time)) * 1000);
		     fps = 0;
		     time = SDL_GetTicks();
	     }
	     else
	     	fps++;
     }
     else
	{
     	  process_events();
  	  demon->setNewHeading(heading);
  	  weapon->setNewHeading(heading);
  	  heading += 0.6f;
  	  if (heading >= 360.0f)
    		heading -= 360.0f;
  	  manager->updateAll();
	  next = SDL_GetTicks() + TICK_INTERVAL;
	}
    }
  
  return 0; /* never reached */
}
开发者ID:cjxgm,项目名称:clabs,代码行数:60,代码来源:demon.C

示例11: received_message

/*
 * Messages incoming from the phone
 */
void received_message(DictionaryIterator *received, void *context) {
   // Gather the bits of a calendar together	
   Tuple *tuple = dict_find(received, CALENDAR_RESPONSE_KEY);
	  
   if (tuple) {
	    set_event_status(STATUS_REPLY);
    	uint8_t i, j;

		if (count > received_rows) {
      		i = received_rows;
      		j = 0;
        } else {
      	    count = tuple->value->data[0];
      	    i = 0;
      	    j = 1;
        }

        while (i < count && j < tuple->length) {
    	    memcpy(&temp_event, &tuple->value->data[j], sizeof(Event));
      	    memcpy(&events[temp_event.index], &temp_event, sizeof(Event));

      	    i++;
      	    j += sizeof(Event);
        }

        received_rows = i;

        if (count == received_rows) {
			    max_entries = count;
			    calendar_request_outstanding = false;
			          process_events();
	    }
	}

}
开发者ID:ShaBP,项目名称:Revolution-Calendar,代码行数:38,代码来源:calendar.c

示例12: sdl_thread

void sdl_thread() {
	for (;;) {

		// Wait for the emulation thread to signal that a frame has completed

		SDL_LockMutex(frame_lock);
		ready_to_draw_new_frame = true;
		while (!frame_available && !pending_sdl_thread_exit)
			SDL_CondWait(frame_available_cond, frame_lock);
		if (pending_sdl_thread_exit) {
			SDL_UnlockMutex(frame_lock);
			return;
		}
		frame_available = ready_to_draw_new_frame = false;
		SDL_UnlockMutex(frame_lock);

		// Process events and calculate controller input state (which might
		// need left+right/up+down elimination)

		process_events();

		// Draw the new frame

		fail_if(SDL_UpdateTexture(screen_tex, 0, front_buffer, 256*sizeof(Uint32)),
				"failed to update screen texture: %s", SDL_GetError());
		fail_if(SDL_RenderCopy(renderer, screen_tex, 0, 0),
				"failed to copy rendered frame to render target: %s", SDL_GetError());
		SDL_RenderPresent(renderer);
	}
}
开发者ID:usrshare,项目名称:nesalizer,代码行数:30,代码来源:sdl_backend.cpp

示例13: surface_manager

	int app::exec(bool aQuitWhenLastWindowClosed)
	{
		try
		{
			surface_manager().layout_surfaces();
			surface_manager().invalidate_surfaces();
			iQuitWhenLastWindowClosed = aQuitWhenLastWindowClosed;
			while (!iQuitResultCode.is_initialized())
				process_events(*iContext);
			return *iQuitResultCode;
		}
		catch (std::exception& e)
		{
			halt();
			std::cerr << "neogfx::app::exec: terminating with exception: " << e.what() << std::endl;
			iSurfaceManager->display_error_message(iName.empty() ? "Abnormal Program Termination" : "Abnormal Program Termination - " + iName, std::string("neogfx::app::exec: terminating with exception: ") + e.what());
			std::exit(EXIT_FAILURE);
		}
		catch (...)
		{
			halt();
			std::cerr << "neogfx::app::exec: terminating with unknown exception" << std::endl;
			iSurfaceManager->display_error_message(iName.empty() ? "Abnormal Program Termination" : "Abnormal Program Termination - " + iName, "neogfx::app::exec: terminating with unknown exception");
			std::exit(EXIT_FAILURE);
		}
	}
开发者ID:FlibbleMr,项目名称:neogfx,代码行数:26,代码来源:app.cpp

示例14: main_loop

void main_loop() {
  struct timespec ptime;
  struct timespec ctime;
  struct timespec diff;
  clock_gettime(CLOCK_MONOTONIC_COARSE, &ctime);
  while (running) {
    clock_gettime(CLOCK_MONOTONIC_COARSE, &ptime);

    reshape_window();
    poll_geometry();
    process_events();
    display_func();

    clock_gettime(CLOCK_MONOTONIC_COARSE, &ctime);
    diff.tv_sec  = ctime.tv_sec - ptime.tv_sec;
    diff.tv_nsec = ctime.tv_nsec - ptime.tv_nsec;
    long sleeptime = 16666666l - ( diff.tv_sec * 1000000000l + diff.tv_nsec );
    diff.tv_sec  = 0;
    diff.tv_nsec = sleeptime;

    while (diff.tv_nsec > 0) {
      struct timespec rem;
      int i = nanosleep(&diff, &rem);
      if (i < 0) {
        diff.tv_sec  = rem.tv_sec;
        diff.tv_nsec = rem.tv_nsec;
      } else {
        break;
      }
    }
  }
}
开发者ID:bobtwinkles,项目名称:voxelvolume,代码行数:32,代码来源:Main.cpp

示例15: main

int main(int argc, char* argv[]) {
	// If intialising of SDL fails -> quit the program with error code 1
	if (!init_SDL()) {
		quit_program(1);
	}
	
	// If intialising of OpenGL fails -> quit the program with error code 1
	if (!init_OpenGL(default_width, default_height)) {
		quit_program(1);
	}
	
	// Repeat forever
	while(true) {
		// Draw your graphics
		draw_screen();
		
		// Process any ocuring events 
		process_events();
		fflush(stdout);
	}
	
	// You shouldn't get here. Only if someone changes the while condition...
	quit_program(0);
	
	return 0;
}
开发者ID:te-bachi,项目名称:cgr,代码行数:26,代码来源:main.c


注:本文中的process_events函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。