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

📄 finalize.h

📁 《移动Agent技术》一书的所有章节源代码。
💻 H
字号:
/*
 * @(#)finalize.h       1.19 97/02/21
 *
 * 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
 *
 */

#ifndef _FINALIZE_H_
#define _FINALIZE_H_

#include "oobj.h"
#include "sys_api.h"

#if defined(IBM_OE_THREADS)                                         /*ibm.3286*/
#include "monitor_md.h"
#endif                                                              /*ibm.3286*/

/*
 * The HasFinalizerQ and FinalizeMeQ queues contain finalizer_t
 * structures.  Handles rather than objects are used to avoid relocating
 * the contents of the queues on GC.
 */
typedef struct {
    JHandle *next;              /* The next finalizer object */
} finalizer_t;

extern JHandle *HasFinalizerQ;
extern JHandle *FinalizeMeQ;
extern JHandle *FinalizeMeQLast;
// ibm.10067
#ifdef IBM_HAIFA_GC
extern JHandle *BeingFinalized;
#endif //IBM_HAIFA_GC 
// ibm.10067 ends


extern bool_t finalize_on_exit;

#ifdef JMS_TRL                                                          /*ibm*/
#define FINALIZER_T(h) \
        ((finalizer_t *)((char *)unhand(h) + cbInstanceSize(obj_classblock(h))))
#else                                                                   /*ibm*/
#define FINALIZER_T(h) \
        ((finalizer_t *)((char *)h->obj + cbInstanceSize(obj_classblock(h))))
#endif                                                                  /*ibm*/

/*
 * Locks for the finalization queues
 */
extern sys_mon_t *_hasfinalq_lock;
#define HASFINALQ_LOCK_INIT()   monitorRegister(_hasfinalq_lock, \
                                                "Has finalization queue lock")
#define HASFINALQ_LOCK()        sysMonitorEnter(_hasfinalq_lock)
#define HASFINALQ_LOCKED()      sysMonitorEntered(_hasfinalq_lock)
#define HASFINALQ_UNLOCK()      sysMonitorExit(_hasfinalq_lock)
#define HASFINALQ_NOTIFY()      sysMonitorNotify(_hasfinalq_lock)

extern sys_mon_t *_finalmeq_lock;
#define FINALMEQ_LOCK_INIT()    monitorRegister(_finalmeq_lock, \
                                                "Finalize me queue lock")
#define FINALMEQ_LOCK()         sysMonitorEnter(_finalmeq_lock)
#define FINALMEQ_LOCKED()       sysMonitorEntered(_finalmeq_lock)
#define FINALMEQ_UNLOCK()       sysMonitorExit(_finalmeq_lock)
#define FINALMEQ_NOTIFY()       sysMonitorNotify(_finalmeq_lock)
#define FINALMEQ_WAIT()         sysMonitorWait(_finalmeq_lock, \
                                               SYS_TIMEOUT_INFINITY, FALSE)

extern void InitializeFinalizer(void);
extern void InitializeFinalizerThread(void);

extern void runFinalization(void);
extern void finalizeOnExit(void);

#endif /* _FINALIZE_H_ */

⌨️ 快捷键说明

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