⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threads_md.h

📁 《移动Agent技术》一书的所有章节源代码。
💻 H
字号:
/*
 * @(#)threads_md.h	1.25 97/10/07
 *
 * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of Sun
 * Microsystems, Inc. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Sun.
 *
 * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
 * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
 * THIS SOFTWARE OR ITS DERIVATIVES.
 *
 * CopyrightVersion 1.1_beta
 *
 */

/*
 * Win32 implementation of Java threads
 */

#ifndef _WIN32_THREADS_MD_H_
#define _WIN32_THREADS_MD_H_

#include <windows.h>
#include "sys_api.h"                                                    /*ibm.5599*/
#include "bool.h"
#include "sysmacros_md.h"

#define N_TRACED_REGS 7

#define SYS_THREAD_NULL         ((sys_thread_t *) 0)

/*
 * Machine dependent info in a sys_thread_t: Keep these values in
 * sync with the string array used by sysThreadDumpInfo() in threads_md.c!
 */
typedef enum {
    FIRST_THREAD_STATE,
    RUNNABLE = FIRST_THREAD_STATE,
    SUSPENDED,
    MONITOR_WAIT,
    CONDVAR_WAIT,
    MONITOR_SUSPENDED,
    NUM_THREAD_STATES
} thread_state_t;

/*
 * Machine dependent thread data structure
 */
typedef struct sys_thread {
    void *cookie;		    /* Back-pointer to shared thread struct */
    HANDLE handle;		    /* Win32 thread handle */
    unsigned long id;   	    /* Win32 thread id */
    void *stack_base;   	    /* Thread stack base */
    thread_state_t state;	    /* Current thread state */
    bool_t system_thread;	    /* TRUE if this is a system thread */
    HANDLE interrupt_event;	    /* Event signaled on thread interrupt */
    bool_t interrupted;		    /* Shadow thread interruption */
    bool_t vmsuspended;		    /* This thread is suspended */
    void *(*start_proc)(void *);    /* Thread start routine address */
    void *start_parm;		    /* Thread start routine parameter */
    struct sys_thread *next;	    /* Next thread in active thread queue */
    unsigned int cacheKey;          /* Key for monitor being looked up */
    void * monitorCache[SYS_TLS_MONCACHE]; /* cache of recently monitors */
#ifdef MON_FLAT                                                         /*ibm.5421*/
  long            index;	  /* MON_FLAT thread index                   */
  struct sys_mon *sleep_lock;	  /* MON_FLAT sleep lock                */
#endif                                                                  /*ibm.5421*/
    bool_t in_finalization;         /* ibm.10067 */
} sys_thread_t;

extern bool_t ThreadsInitialized;

/*****************************************************************************/
/* MON_FLAT thread index/thread pointer mappings                             */
/*****************************************************************************/
#ifdef MON_FLAT                                                         /*ibm.5421*/
typedef struct thread_index_cb_t {
  long count;
  long length;
  struct sys_thread **buf;
} thread_index_cb_t;

extern thread_index_cb_t ticb;

struct sys_thread *sysThreadIndexToThread(int idx);
#ifdef DEBUG                                                            /*ibm.6233*/
long sysThreadIndex(struct sys_thread *tid);
#else                                                                   /*ibm.6233*/
#define sysThreadIndex(tid) (tid->index)
#endif                                                                  /*ibm.6233*/
#endif                                                                  /*ibm.5421*/

#endif /* !_WIN32_THREADS_MD_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -