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


C++ LOCK_VARIABLE函数代码示例

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


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


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