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

C++ LOCK_VARIABLE函数代码示例

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

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: emu8k_lock

/* emu8k_lock:
 *  Locks all data and functions which might be called in an interrupt context.
 */
void emu8k_lock() {
 LOCK_VARIABLE(_emu8k_baseport);
 LOCK_VARIABLE(_emu8k_numchannels);

 LOCK_FUNCTION(emu8k_startsound);
 LOCK_FUNCTION(emu8k_releasesound);
 LOCK_FUNCTION(emu8k_modulate_atten);
 LOCK_FUNCTION(emu8k_modulate_ip);
 LOCK_FUNCTION(emu8k_modulate_pan);
 LOCK_FUNCTION(emu8k_terminatesound);
}
开发者ID:Ringdingcoder,项目名称:d1x,代码行数:14,代码来源:emu8k.c


示例5: 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


示例6: 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


示例7: key_adb_init

static int key_adb_init(void)
{
   OSErr e;
   short adb_command;
   short adb_devices;
   char adb_key_registers[8];
   ADBAddress adb_address;
   ADBSetInfoBlock mySet;

   adb_key_cpt_upp = NewADBCompletionUPP(adb_command_callback);
   adb_key_upp = NewADBServiceRoutineUPP (key_adb_interrupt);

   adb_devices = CountADBs();
   for(adb_keyboard_id = 1 ; adb_keyboard_id <= adb_devices ; adb_keyboard_id++){
      adb_address = GetIndADB(&adb_key_save, adb_keyboard_id);
      e = GetADBInfo(&adb_key_save, adb_address);
      if(adb_key_save.origADBAddr == ADB_KEYBOARD){
         switch (adb_key_save.devType){
            case 2:case 3:case 5:
	       LOCK_VARIABLE(KeyNow);
 	       LOCK_VARIABLE(KeyOld);
 	       LOCK_VARIABLE(_mouse2nd);
 	       LOCK_VARIABLE(adb_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_adb_interrupt);*/
/*	       LOCK_FUNCTION(adb_command_callback);*/

               mySet.siService = adb_key_upp;
	       mySet.siDataAreaAddr = NULL;
	       SetADBInfo (&mySet,adb_address);
               adb_key_registers[0] = 2;
               adb_command = (adb_address * 16) + ADB_TALKMASK + ADB_TYPEREGISTER;
	       if (send_adb_command_sync(adb_key_registers, adb_command) == noErr){
		  adb_key_registers[2] = 3;
                  adb_command = (adb_address * 16) + ADB_LISTENMASK + ADB_TYPEREGISTER;
                  send_adb_command_sync(adb_key_registers, adb_command);
               }
               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);
               return 0;
            default:
               break;
      	 }
      }
   }
   adb_keyboard_id=0;
   return -1;
}
开发者ID:Yurand,项目名称:tw-light,代码行数:57,代码来源:madb.c


示例8: 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


示例9: __libnet_internal__serial_init

int __libnet_internal__serial_init(void)
{
    LOCK_FUNCTION(enable_thre_int);
    LOCK_FUNCTION(disable_thre_int);
    LOCK_FUNCTION(isr);
    LOCK_FUNCTION(isr_wrapper_0);
    LOCK_FUNCTION(isr_wrapper_1);
    LOCK_FUNCTION(isr_wrapper_2);
    LOCK_FUNCTION(isr_wrapper_3);
    LOCK_VARIABLE(port_0);
    LOCK_VARIABLE(port_1);
    LOCK_VARIABLE(port_2);
    LOCK_VARIABLE(port_3);
    return 0;
}
开发者ID:haision,项目名称:GitHub_C,代码行数:15,代码来源:serdos.c


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: 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


示例18: _ji_system_init

int _ji_system_init()
{
  /* Install timer related stuff.  */
  LOCK_VARIABLE(ji_clock);
  LOCK_VARIABLE(m_b);
  LOCK_FUNCTION(clock_inc);

  if (install_int_ex(clock_inc, BPS_TO_TIMER(1000)) < 0)
    return -1;

  if (screen)
    jmouse_poll();

  moved = true;
  mouse_cursor_type = kNoCursor;

  return 0;
}
开发者ID:atzkey,项目名称:aseprite,代码行数:18,代码来源:system.cpp


示例19: init_at_startup

void init_at_startup(void)
{

   allegro_init();

   install_keyboard();
   install_timer();

   three_finger_flag = 0;
   key_led_flag = 0;

//   LOCK_FUNCTION (framecount);
   LOCK_FUNCTION (tickover);
   LOCK_VARIABLE (ticked);
//   LOCK_VARIABLE (tick_counter);
//   LOCK_VARIABLE (frames_per_second);
//   LOCK_VARIABLE (framecounter);
   LOCK_VARIABLE (turns_per_second);
   LOCK_VARIABLE (turncounter);
//   LOCK_VARIABLE (inputs_per_second);
//   LOCK_VARIABLE (inputcounter);

//   install_int (framecount, 1000);
   install_int (tickover, 30);

   set_color_depth(8);
   init_config();

   if (set_gfx_mode((options.windowed == 1) ? GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0) != 0)
   {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Unable to set 640x480 mode\n%s\n", allegro_error);
      exit(1);
   }

   init_palette();

   init_display();
   init_menus_once_only();

   init_sound(); // must come after init_menus_once_only, as that's where
    // options.sound_enabled is set.

}
开发者ID:evktalo,项目名称:lacewing,代码行数:44,代码来源:main.c


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LOCTEXT函数代码示例发布时间:2022-05-30
下一篇:
C++ LOCK_TEST_WITH_RETURN函数代码示例发布时间: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