📄 events.h
字号:
/*0001*//*
/*0002./ * Copyright (c) 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
/*0003./ *
/*0004./ * This software is the confidential and proprietary information of Sun
/*0005./ * Microsystems, Inc. ("Confidential Information"). You shall not
/*0006./ * disclose such Confidential Information and shall use it only in
/*0007./ * accordance with the terms of the license agreement you entered into
/*0008./ * with Sun.
/*0009./ *
/*0010./ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
/*0011./ * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
/*0012./ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/*0013./ * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
/*0014./ * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
/*0015./ * THIS SOFTWARE OR ITS DERIVATIVES.
/*0016./ *
/*0017./ */
/*0018*/
/*0019*//*=========================================================================
/*0020./ * SYSTEM: KVM
/*0021./ * SUBSYSTEM: Event handling support
/*0022./ * FILE: events.h
/*0023./ * OVERVIEW: This file defines the macros and operations for
/*0024./ * binding the interpreter to the event handling
/*0025./ * mechanisms of the host operating system in a
/*0026./ * portable fashion.
/*0027./ * AUTHOR: Nik Shaylor 4/20/00
/*0028./ * Original Palm OS specific implementation by Doug Simon 1998
/*0029./ *=======================================================================*/
/*0030*/
/*0031*//*=========================================================================
/*0032./ * Include files
/*0033./ *=======================================================================*/
/*0034*/
/*0035*//*=========================================================================
/*0036./ * Event system macros
/*0037./ *=======================================================================*/
/*0038*/
/*0039*//*=========================================================================
/*0040./ * Thread scheduling macros.
/*0041./ * These are here to isolate the scheduling code out of interpret.c.
/*0042./ * Note that the thread switching macros are normally used also for
/*0043./ * driving the event handling/polling mechanism,
/*0044./ *=======================================================================*/
/*0045*/
/*0046*//*
/*0047./ * Indicate task switching is necessary
/*0048./ * (enforce a thread switch)
/*0049./ */
/*0050*/#define signalTimeToReschedule() (Timeslice = 0)
/*0051*/
/*0052*//*
/*0053./ * Determine if it is time to reschedule
/*0054./ * (by decrementing the time slice and comparing
/*0055./ * it to zero)
/*0056./ */
/*0057*/#define isTimeToReschedule() (Timeslice-- == 0)
/*0058*/
/*0059*//*
/*0060./ * Check that the time slice value is not junk
/*0061./ * (should never happen)
/*0062./ */
/*0067*/#define checkRescheduleValid() /**/
/*0069*/
/*0070*//*
/*0071./ * InterpreterHandleEvent
/*0072./ *
/*0073./ * This function ties the virtual machine with events coming
/*0074./ * from the host operating system. Since CLDC itself does
/*0075./ * not define any event handling capabilities, the function
/*0076./ * pretty much empty in those builds that don't include any
/*0077./ * additional classes beyond CLDC.
/*0078./ *
/*0079./ */
/*0080*/void InterpreterHandleEvent(ulong64);
/*0081*/
/*0094*//*
/*0095./ * Reschedule
/*0096./ *
/*0097./ * This routine is called from inside the interpreter when
/*0098./ * it is time to perform thread switching.
/*0099./ *
/*0100./ */
/*0101*/#define reschedule() \
/*0102*/ do { \
/*0103*/ ulong64 wakeupTime; \
/*0104*/ if (!areAliveThreads()) { \
/*0105*/ return; /* end of program */ \
/*0106*/ } \
/*0107*/ checkTimerQueue(&wakeupTime); \
/*0108*/ InterpreterHandleEvent(wakeupTime); \
/*0110*/ } while (!SwitchThread());
/*0111*/
/*0112*/
/*0113*//*=========================================================================
/*0114./ * Data structures needed for event handling
/*0115./ *=======================================================================*/
/*0116*/
/*0117*/#define appStopKVMEvent -1
/*0118*/
/*0119*//*=========================================================================
/*0120./ * Event handling functions
/*0121./ *=======================================================================*/
/*0122*/
/*0123*/extern int eventCount; /* Number of events on event queue */
/*0124*/
/*0125*/void InitializeEvents(void);
/*0126*/
/*0127*/void StoreKVMEvent(cell type, int argCount, /* cell cell cell */ ... );
/*0128*/
/*0129*//*
/*0130./ * GetAndStoreNextKVMEvent
/*0131./ *
/*0132./ * Platform-specific function for reading events from the host
/*0133./ * operating system. This function typically needs to be ported
/*0134./ * to use the low-level event handling mechanisms of the host
/*0135./ * platform.
/*0136./ */
/*0137*/
/*0138*/void
/*0139*/GetAndStoreNextKVMEvent(bool_t forever, ulong64 waitUntil);
/*0140*/
/*0141*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -