Reading Gauche/Reading Gauche 0.9/gc/finalize.c/GC_invoke_finalizers


Top / Reading Gauche / Reading Gauche 0.9 / gc / finalize.c / GC_invoke_finalizers

GC_invoke_finalizers(void)

概要

ひら完了後、編集予定。

/* Invoke finalizers for all objects that are ready to be finalized.	*/
/* Should be called without allocation lock.				*/
int GC_invoke_finalizers(void)
{
   struct finalizable_object * curr_fo;
   int count = 0;
   word bytes_freed_before;
   DCL_LOCK_STATE;
   
   while (GC_finalize_now != 0) {
#	ifdef THREADS
	    LOCK();
#	endif
	if (count == 0) {
	    bytes_freed_before = GC_bytes_freed;
	    /* Don't do this outside, since we need the lock. */
	}
   	curr_fo = GC_finalize_now;
#	ifdef THREADS
	    if (curr_fo != 0) GC_finalize_now = fo_next(curr_fo);
	    UNLOCK();
	    if (curr_fo == 0) break;
#	else
	    GC_finalize_now = fo_next(curr_fo);
#	endif
	fo_set_next(curr_fo, 0);
   	(*(curr_fo -> fo_fn))((ptr_t)(curr_fo -> fo_hidden_base),
   			      curr_fo -> fo_client_data);
   	curr_fo -> fo_client_data = 0;
	++count;
#	ifdef UNDEFINED
	    /* This is probably a bad idea.  It throws off accounting if */
	    /* nearly all objects are finalizable.  O.w. it shouldn't	 */
	    /* matter.							 */
   	    GC_free((void *)curr_fo);
#	endif
   }
   /* bytes_freed_before is initialized whenever count != 0 */
   if (count != 0 && bytes_freed_before != GC_bytes_freed) {
       LOCK();
	GC_finalizer_bytes_freed += (GC_bytes_freed - bytes_freed_before);
	UNLOCK();
   }
   return count;
}

調べるもの

参照元

コメント

コメントはありません。 コメント/Reading Gauche/Reading Gauche 0.9/gc/finalize.c/GC_invoke_finalizers?

お名前:

MENU

now: 5

リンク


最新の20件
2020-05-27 2020-05-22 2020-05-14 2020-05-12 2020-05-10 2020-04-27 2020-03-23
最新の20件
2010-02-01 2010-01-31 2010-01-30 2010-01-29 2010-01-16

Counter: 1300, today: 1, yesterday: 2

リロード   新規 編集 凍結 差分 添付 複製 改名   トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS

Last-modified: 2010-01-04 (月) 18:09:27 (3798d);  Modified by mona
PukiWiki 1.4.6 Copyright © 2001-2005 PukiWiki Developers Team. License is GPL.
Based on "PukiWiki" 1.3 by yu-ji
Powered by PHP 5.2.17
HTML convert time to 0.040 sec.