アットウィキロゴ

TclInitSubsystems

概要

Tcl内部のサブシステムの初期化

引数

無し

戻り値

無し

処理


 inFinalizeが0でなければTclPanicを呼び出す
 if (inFinalize != 0) {
  Tcl_Panic("TclInitSubsystems called while finalizing");
 }
 subsystemsInitialized が0の時初期化を行う
 if (subsystemsInitialized == 0) {
  TclInitLockでLockに使用する変数の初期化を行い、initLockを使ってクリティカルセクションに入る。
  TclpInitLock();
 	if (subsystemsInitialized == 0) {
 	    /*
 	     * Have to set this bit here to avoid deadlock with the routines
 	     * below us that call into TclInitSubsystems.
 	     */
 
 	    subsystemsInitialized = 1;
 
 	    /*
 	     * Initialize locks used by the memory allocators before anything
 	     * interesting happens so we can use the allocators in the
 	     * implementation of self-initializing locks.
 	     */
 
 	    TclInitThreadStorage();     /* Creates master hash table for
 					 * thread local storage */
 #if USE_TCLALLOC
 	    TclInitAlloc();		/* Process wide mutex init */
 #endif
 #ifdef TCL_MEM_DEBUG
 	    TclInitDbCkalloc();		/* Process wide mutex init */
 #endif
 
 	    TclpInitPlatform();		/* Creates signal handler(s) */
 	    TclInitDoubleConversion();	/* Initializes constants for
 					 * converting to/from double. */
     	    TclInitObjSubsystem();	/* Register obj types, create
 					 * mutexes. */
 	    TclInitIOSubsystem();	/* Inits a tsd key (noop). */
 	    TclInitEncodingSubsystem();	/* Process wide encoding init. */
 	    TclpSetInterfaces();
     	    TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */
 	}
 	TclpInitUnlock();
     }
     TclInitNotifier();
 }


ソース

 TclInitSubsystems(void)
 {
     if (inFinalize != 0) {
 	Tcl_Panic("TclInitSubsystems called while finalizing");
     }
 
     if (subsystemsInitialized == 0) {
 	/*
 	 * Double check inside the mutex. There are definitly calls back into
 	 * this routine from some of the functions below.
 	 */
 
 	TclpInitLock();
 	if (subsystemsInitialized == 0) {
 	    /*
 	     * Have to set this bit here to avoid deadlock with the routines
 	     * below us that call into TclInitSubsystems.
 	     */
 
 	    subsystemsInitialized = 1;
 
 	    /*
 	     * Initialize locks used by the memory allocators before anything
 	     * interesting happens so we can use the allocators in the
 	     * implementation of self-initializing locks.
 	     */
 
 	    TclInitThreadStorage();     /* Creates master hash table for
 					 * thread local storage */
 #if USE_TCLALLOC
 	    TclInitAlloc();		/* Process wide mutex init */
 #endif
 #ifdef TCL_MEM_DEBUG
 	    TclInitDbCkalloc();		/* Process wide mutex init */
 #endif
 
 	    TclpInitPlatform();		/* Creates signal handler(s) */
 	    TclInitDoubleConversion();	/* Initializes constants for
 					 * converting to/from double. */
     	    TclInitObjSubsystem();	/* Register obj types, create
 					 * mutexes. */
 	    TclInitIOSubsystem();	/* Inits a tsd key (noop). */
 	    TclInitEncodingSubsystem();	/* Process wide encoding init. */
 	    TclpSetInterfaces();
     	    TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */
 	}
 	TclpInitUnlock();
     }
     TclInitNotifier();
 }
最終更新:2011年11月10日 22:18