• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOCK_FUNCTION函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mpu_init

/* mpu_init:
 *  Initialises the MPU-401 midi interface.
 */
static int mpu_init(int input, int voices)
{
   if (!mpu_output_mode) {
      /* only do the hardware initialisation once */
      outportb(_mpu_port+1, 0x3F);
      mpu_input();

      LOCK_VARIABLE(midi_mpu401);
      LOCK_VARIABLE(_mpu_port);
      LOCK_VARIABLE(_mpu_irq);
      LOCK_FUNCTION(_mpu_poll);
      LOCK_FUNCTION(mpu_output);
      LOCK_FUNCTION(mpu_interrupt);
   }

   if (input) {
      /* only hook the interrupt if we have direct access to it */
      if (!mpu_piggyback) {
	 _enable_irq(_mpu_irq);
	 _install_irq(mpu_int, mpu_interrupt);
      }
      mpu_input_mode = TRUE;
   }
   else
      mpu_output_mode = TRUE;

   return 0;
}
开发者ID:AntonLanghoff,项目名称:whitecatlib,代码行数:31,代码来源:mpu.c


示例2: key_mac_init

static int key_mac_init(void)
{

#if (TRACE_MAC_KBRD)
   fprintf(stdout, "key_mac_init()\n");
   fflush(stdout);
#endif
   GetKeys(KeyNow);
   _key_shifts=0;
   if(BitTst(KeyNow,k_apple_shift) || BitTst(KeyNow,k_apple_rshift))_key_shifts |= KB_SHIFT_FLAG;
   if(BitTst(KeyNow,k_apple_alt) || BitTst(KeyNow,k_apple_altgr))_key_shifts |= KB_ALT_FLAG;
   if(BitTst(KeyNow,k_apple_control) || BitTst(KeyNow,k_apple_rcontrol))_key_shifts |= KB_CTRL_FLAG;
   _mouse2nd=BitTst(KeyNow,k_2nd);
   LOCK_VARIABLE(KeyNow);
   LOCK_VARIABLE(KeyOld);
   LOCK_VARIABLE(key_apple_to_allegro);
   LOCK_VARIABLE(modifier_table);
   LOCK_VARIABLE(standard_key_ascii_table);
   LOCK_VARIABLE(standard_key_capslock_table);
   LOCK_VARIABLE(standard_key_shift_table);
   LOCK_VARIABLE(standard_key_control_table);
   LOCK_FUNCTION(_key_mac_interrupt);
   LOCK_FUNCTION(_handle_mac_key_press);
   LOCK_FUNCTION(_handle_mac_key_release);
   
   BlockMove(KeyNow, KeyOld, sizeof(KeyMap));
   if (!tm_running)
      _tm_sys_init();
   _mac_keyboard_installed=1;
   return 0;
}
开发者ID:AntonLanghoff,项目名称:whitecatlib,代码行数:31,代码来源:mkey.c


示例3: ustrzcpy

/* xtended_init:
 *  Selects the unchained 640x400 mode.
 */
static BITMAP *xtended_init(int w, int h, int v_w, int v_h, int color_depth)
{
   unsigned long addr;
   BITMAP *b;

   /* Do not continue if this version of Allegro was built in C-only mode.
    * The bank switchers assume asm-mode calling conventions, but the
    * library would try to call them with C calling conventions.
    */
#ifdef ALLEGRO_NO_ASM
   return NULL;
#endif

   /* see modexsms.c */
   _split_modex_screen_ptr = really_split_modex_screen;

   /* check it is a valid resolution */
   if (color_depth != 8) {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Xtended mode only supports 8 bit color"));
      return NULL;
   }

   if ((w != 640) || (h != 400) || (v_w > 640) || (v_h > 400)) {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Xtended mode only supports 640x400"));
      return NULL;
   }

   /* lock everything that is used to draw mouse pointers */
   LOCK_VARIABLE(__modex_vtable); 
   LOCK_FUNCTION(_x_draw_sprite);
   LOCK_FUNCTION(_x_blit_from_memory);
   LOCK_FUNCTION(_x_blit_to_memory);

   /* set VESA mode 0x100 */
   addr = _set_vga_mode(0x100);

   if (!addr) {
      ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("VESA mode 0x100 not available"));
      return NULL;
   }

   outportw(0x3C4, 0x0604);         /* disable chain-4 */

   /* we only use 1/4th of the width for the bitmap line pointers */
   b = _make_bitmap(640/4, 400, addr, &gfx_xtended, 8, 640/4);
   if (!b)
      return NULL;

   b->w = b->cr = 640;
   b->vtable = &__modex_vtable;
   b->id |= BMP_ID_PLANAR;

   setup_x_magic(b);

   return b;
}
开发者ID:Yurand,项目名称:tw-light,代码行数:59,代码来源:modex.c


示例4: main

int main()
{
  std::srand(std::time(NULL));

  allegro_init();
  install_timer();
  install_keyboard();
//   install_mouse();
  install_joystick(JOY_TYPE_AUTODETECT);

  override_config_file(redir("defnot.ini").c_str());

  gfx_widescreen = get_config_int("Game", "Widescreen", gfx_widescreen);
  gfx_fullscreen = get_config_int("Game", "Fullscreen", gfx_fullscreen);

  if (!setup_gfx() != 0) {
    allegro_message("Unable to setup the graphics mode\n");
    return 1;
  }

//   if (gfx_capabilities & GFX_HW_CURSOR) {
//     enable_hardware_cursor();
//     select_mouse_cursor(MOUSE_CURSOR_ARROW);
//     show_mouse(screen);
//   }

  if (!load_media()) {
    allegro_message("Unable to load data files to play the game\n");
    return 1;
  }

  // install the timer to control the game speed
  LOCK_VARIABLE(beats);
  LOCK_FUNCTION(timer_control);

  beats = 0;
  install_int_ex(timer_control, BPS_TO_TIMER(BPS));

  // insert the callback routine for the close-button
  LOCK_VARIABLE(continuing);
  LOCK_FUNCTION(close_button);

  set_close_button_callback(close_button);

  // play the game
  game_loop();

  set_config_int("Game", "Widescreen", gfx_widescreen);
  set_config_int("Game", "Fullscreen", gfx_fullscreen);

  remove_int(timer_control);
  allegro_exit();
  return 0;
}
开发者ID:dacap,项目名称:defenderofnothing,代码行数:54,代码来源:main.cpp


示例5: Frame_Skipper_Init

void    Frame_Skipper_Init (void)
{
    // Auto Frame Skipper
    LOCK_VARIABLE (fskipper.Automatic_Frame_Elapsed);
    LOCK_FUNCTION (Frame_Skipper_Auto_Adjust_Handler);
    Frame_Skipper_Auto_Install_Handler ();
    // FPS Counter
    LOCK_VARIABLE (fskipper.New_Second);
    LOCK_FUNCTION (Frame_Skipper_New_Second_Handler);
    Frame_Skipper_New_Second_Handler ();
    install_int_ex (Frame_Skipper_New_Second_Handler, TIMERS_PER_SECOND);
}
开发者ID:dafyddcrosby,项目名称:meka,代码行数:12,代码来源:fskipper.c


示例6: main

int main(int argc, char **argv) {
    allegro_init();
    set_color_depth(32);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, SCRW, SCRH, 0, 0);
    install_keyboard();
    install_mouse();
    install_timer();

    LOCK_VARIABLE(timer);
    LOCK_FUNCTION(timerupdate);
    install_int_ex(timerupdate, BPS_TO_TIMER(TIMER_BPS));

    srand((unsigned)time(NULL));
    set_window_title("Skat");

    LOCK_FUNCTION(close_handler);
    set_close_button_callback(close_handler);

    cards = load_bitmap("images/cards.tga", NULL);
    game.p[0] = &human;
    game.p[1] = &cpu1;
    game.p[2] = &cpu2;
    human.choose_card = human_choose_card;
    cpu1.choose_card = cpu_choose_card;
    cpu2.choose_card = cpu_choose_card;
    human.choose_game = human_choose_game;
    cpu1.choose_game = cpu_choose_game;
    cpu2.choose_game = cpu_choose_game;
    human.reizen = human_reizen;
    cpu1.reizen = cpu_reizen;
    cpu2.reizen = cpu_reizen;
    human.schieben = human_schieben;
    cpu1.schieben = cpu_schieben;
    cpu2.schieben = cpu_schieben;
    human.kontra = human_kontra;
    cpu1.kontra = cpu_kontra;
    cpu2.kontra = cpu_kontra;
    human.name = "Stefan";
    cpu1.name = "Robert";
    cpu2.name = "Thomas";
    human.rtext = cpu1.rtext = cpu2.rtext = NULL;
    human.total_points = 0;
    cpu1.total_points = 0;
    cpu2.total_points = 0;

    enable_hardware_cursor();
    show_mouse(screen);

    buffered_do_dialog(main_dlg, -1);

    destroy_bitmap(cards);
}
开发者ID:ThomasWitte,项目名称:sskat,代码行数:52,代码来源:skat.c


示例7: alogg_play_ex_oggstream

int alogg_play_ex_oggstream(ALOGG_OGGSTREAM *ogg, int buffer_len, int vol, int pan, int speed) {
  int samples;
 
  /* continue only if we are not already playing it */
  if (alogg_is_playing_oggstream(ogg))
    return ALOGG_OK;

  /* check the buffer is big enough*/
  if (buffer_len < 4096)
    return ALOGG_PLAY_BUFFERTOOSMALL;
   
  /* create a new audiostream and play it */
  samples = buffer_len / (ogg->stereo ? 2 : 1) / 2; /* / 2 = 16 bits samples */
  ogg->audiostream = play_audio_stream(samples, 16, ogg->stereo, ogg->freq, vol, pan);
  ogg->audiostream_buffer_len = samples * (ogg->stereo ? 2 : 1) * 2; /* * 2 = 16 bits samples */

  ogg->wait_for_audio_stop = 0;

  if (speed != 1000)
    adjust_sample(ogg->audiostream->samp, vol, pan, speed, TRUE);

  /* if the user asked for autopolling, install the interrupt now */
  if (ogg->auto_polling) {
    LOCK_FUNCTION(alogg_autopoll_oggstream);
    install_param_int(&alogg_autopoll_oggstream, (void *)ogg, ogg->auto_poll_speed);
  }

  return ALOGG_OK;
}
开发者ID:AlanDrake,项目名称:Adventure-Game-Studio,代码行数:29,代码来源:alogg.c


示例8: install_timer

void Time::init()
{
	install_timer();
	LOCK_VARIABLE(myCurrentTick);
	LOCK_FUNCTION(callback);
	install_int_ex(callback, BPS_TO_TIMER(Time::TicksPerSecond));
}
开发者ID:olofn,项目名称:db_public,代码行数:7,代码来源:Time.cpp


示例9: sleep_init

void sleep_init(int mins)
{
   char txt[256];

   LOCK_FUNCTION(sleep_timeout);
   LOCK_FUNCTION(sleep_fadeout);

   /* See if fading is required */

   sprintf(txt,get_config_string("[options]","sleep_fade","yes"));

   if(stricmp(txt,"YES") == 0)
      sleep_want_fade = TRUE;

   install_int_ex(sleep_timeout, SECS_TO_TIMER(mins*60));
}
开发者ID:cravo,项目名称:damp,代码行数:16,代码来源:sleep.c


示例10: signal

bool OSD::Init (bool fFirstInit_/*=false*/)
{
    bool fRet = false;

#ifndef _DEBUG
    // Ignore Ctrl-C and Ctrl-Break in release modes
    signal(SIGINT, SIG_IGN);
#endif

#ifdef ALLEGRO_WINDOWS
    // We'll do our own error handling, so suppress any windows error dialogs
    SetErrorMode(SEM_FAILCRITICALERRORS);
#endif

    LOCK_VARIABLE(OSD::s_nTicks);
    LOCK_FUNCTION(TimerCallback);

    if (fFirstInit_ && !fAllegroInit)
        allegro_init();

    install_int_ex(TimerCallback, BPS_TO_TIMER(EMULATED_FRAMES_PER_SECOND));

    fRet = true;
    return fRet;
}
开发者ID:DavidKnight247,项目名称:simcoupe,代码行数:25,代码来源:OSD.cpp


示例11: run_demo

static void run_demo (void)
{
	set_color_depth (16);
	if (set_gfx_mode(GFX_OPENGL, width, height, 0, 0) < 0) {
		allegro_message ("Error setting OpenGL graphics mode:\n%s\nAllegro GL error : %s\n", allegro_error, allegro_gl_error);
		return;
	}

	install_keyboard();

	LOCK_FUNCTION(secs_timer);
	LOCK_VARIABLE(secs);

	glClearColor (0, 0, 0, 0);
	glShadeModel (GL_FLAT);
	glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
	glPolygonMode (GL_BACK, GL_POINTS);
	glEnable (GL_DEPTH_TEST);
	glCullFace (GL_BACK);
	glEnable (GL_CULL_FACE);

	install_int (secs_timer, 1000);

	do {
		keyboard();
		rest(2);
	} while (!key[KEY_ESC]);

	remove_int (secs_timer);

	remove_keyboard();
}
开发者ID:AntonLanghoff,项目名称:whitecatlib,代码行数:32,代码来源:dialog.c


示例12: main

//Main function
int main(){
	//Allegro init
	allegro_init();
	set_color_depth(32); 
	set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1280, 960, 0, 0);
	set_window_title("Chuckie Egg");
	srand(time(NULL));

	//Installations
	install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,0);
	install_timer();
	install_keyboard();
	install_mouse();

	//Close button
    LOCK_FUNCTION(close_button_handler);
    set_close_button_callback(close_button_handler);

	//Show menu
	ce_menu *menu = new ce_menu();
	menu->setupMenu();
	menu->showMenu();
	delete menu;

	allegro_exit();

	return 1;
}
开发者ID:VictorLeach96,项目名称:ChuckieEgg,代码行数:29,代码来源:main.cpp


示例13: init_vidmode

static int init_vidmode ()
{
	int i;
	RGB p;

	install_keyboard();
	install_timer();
	/*install_mouse();*/

	LOCK_VARIABLE (clock_ticks);
	LOCK_FUNCTION (tick_increment);

	install_int_ex (tick_increment, BPS_TO_TIMER (TICK_SECONDS));

	screen_buffer = create_bitmap (GFX_WIDTH, GFX_HEIGHT);
	clear(screen_buffer);

	clock_count = 0;
	clock_ticks = 0;

	set_gfx_mode(GFX_VGA, GFX_WIDTH, GFX_HEIGHT, 0, 0);

	for(i = 0; i < 32; i++) {
		p.r = palette[(i*3)+0];
		p.g = palette[(i*3)+1];
		p.b = palette[(i*3)+2];
		set_color(i, &p);
	}

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


示例14: setup_x_magic

/* setup_x_magic:
 *  To make sure that things will go on working properly even if a few
 *  bits of code don't know about mode-X screens, we do special magic
 *  inside the bank switch functions to emulate a linear image surface.
 *  Whenever someone tries to access the screen directly, these routines
 *  copy the planar image into a temporary buffer, let the client write
 *  there, and then automatically refresh the screen with the updated
 *  graphics. Very slow, but it makes 100% sure that everything will work.
 */
static void setup_x_magic(BITMAP *b)
{
   #ifdef ALLEGRO_DOS

      /* DOS buffer has to go in conventional memory */
      int seg = __dpmi_allocate_dos_memory((b->w+15)/16, &magic_sel);

      if (seg > 0)
	 _x_magic_buffer_addr = seg*16;
      else
	 _x_magic_buffer_addr = 0;

   #else

      /* other platforms can put the buffer wherever they like */
      _x_magic_buffer_addr = (unsigned long)_AL_MALLOC(b->w);

   #endif

   _x_magic_screen_addr = 0;
   _x_magic_screen_width = 0;

   LOCK_VARIABLE(_x_magic_buffer_addr);
   LOCK_VARIABLE(_x_magic_screen_addr);
   LOCK_VARIABLE(_x_magic_screen_width);
   LOCK_FUNCTION(_x_bank_switch);

   b->write_bank = b->read_bank = _x_bank_switch;
}
开发者ID:Yurand,项目名称:tw-light,代码行数:38,代码来源:modex.c


示例15: dzdos_fixed_timer_init

/* fixed_timer_init:
 *  Installs the fixed-rate timer driver.
 */
int dzdos_fixed_timer_init()
{
   int i;

   detect_os();

   LOCK_VARIABLE(dzdos_timedrv_fixed_rate);
   LOCK_VARIABLE(dzdos_bios_counter);
   LOCK_FUNCTION(dzdos_fixed_timer_handler);

   dzdos_bios_counter = 0x10000;

   if (_dzdos_install_irq(TIMER_INT, dzdos_fixed_timer_handler) != 0)
      return -1;

   DISABLE();

   /* sometimes it doesn't seem to register if we only do this once... */
   for (i=0; i<4; i++)
      dzdos_set_timer_rate(LOVEBILL_TIMER_SPEED);

   ENABLE();

   return 0;
}
开发者ID:gdawg,项目名称:scantool-ubuntu,代码行数:28,代码来源:dtimer.c


示例16: init_frame_speed

void init_frame_speed()
{
	LOCK_VARIABLE(frame_counter);
	LOCK_FUNCTION(increment_frame_counter);

    if(install_int_ex(increment_frame_counter, BPS_TO_TIMER(1000))<0)return;
}
开发者ID:arvidfm,项目名称:fiend,代码行数:7,代码来源:misc.c


示例17: set_up_timer

void set_up_timer()
{
  install_timer();
  srand(time(NULL));
  LOCK_VARIABLE(elapsed_time);
  LOCK_FUNCTION(__inc_elapsed_time);
  install_int_ex(__inc_elapsed_time, BPS_TO_TIMER(1000));
}
开发者ID:awhipple,项目名称:3DEngine,代码行数:8,代码来源:aaron.cpp


示例18: clock_init

void clock_init()
{
  // Install timer related stuff
  LOCK_VARIABLE(clock_var);
  LOCK_FUNCTION(clock_inc);

  install_int_ex(clock_inc, BPS_TO_TIMER(1000));
}
开发者ID:1007650105,项目名称:aseprite,代码行数:8,代码来源:clock.cpp


示例19: main

int main()
{
	Game_sys game;

	LOCK_VARIABLE( counter ); // FPS control
	LOCK_FUNCTION( incrctrl );
	install_int_ex( incrctrl, BPS_TO_TIMER( 30 ) );

	game.LoadFiles();
	game.ConfigureMusic();

	while( !game.GetDone() && game.GetGameState() == 1 ) // splash screen and story
	{
        while( counter > 0 )
        {
		game.UpdateSplashNStory();
		counter -= 1;
        }
		game.DrawCrntScreen();
	}

	game.ConfigureMusic();

	while( !game.GetDone() && game.GetGameState() == 2 ) // gameplay
	{
        while( counter > 0 )
        {
		game.Update();
		counter -= 1;
        }
		game.Draw();
	}

	game.ConfigureMusic();

	while( !game.GetDone() && game.GetGameState() == 3 ) // story good end
	{
        while( counter > 0 )
        {
		game.UpdateSplashNStory();
		counter -= 1;
        }
		game.DrawCrntScreen();
	}

	while( !game.GetDone() && game.GetGameState() == 4 ) // story bad end
	{
        while( counter > 0 )
        {
		game.UpdateSplashNStory();
		counter -= 1;
        }
		game.DrawCrntScreen();
	}


	return 0;
}
开发者ID:BozhidarHrusanov,项目名称:Small_projects,代码行数:58,代码来源:main.cpp


示例20: int33_init

/* int33_init:
 *  Initialises the int 0x33 driver.
 */
static int int33_init(void)
{
   if (os_type == OSTYPE_WINNT)
      return -1;

   LOCK_VARIABLE(mousedrv_int33);
   LOCK_FUNCTION(int33_handler);

   return init_mouse(int33_handler);
}
开发者ID:Yurand,项目名称:tw-light,代码行数:13,代码来源:dmouse.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOCK_HARDWARE函数代码示例发布时间:2022-05-30
下一篇:
C++ LOCK_CONTENDED函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap