thread-safety debugging tip

From: Date: Fri, 24 Sep 1999 12:50:20 +0000
Subject: thread-safety debugging tip
Groups: php.version4 
Request: Send a blank email to php-version4+get-4852@lists.php.net to get a copy of this message
For extension maintainers who are trying to make their code thread-safe, here's a trick on how to ensure the proper macros are used in the right places when developing in non-thread-safe mode: #ifdef ZTS ... #else # ifdef TSDEBUG # define NNLS_D int Thread_Safety # define NNLS_DC ,int Thread_Safety # define NNLS_C Thread_Safety # define NNLS_CC ,Thread_Safety # define NNG(v) ((void)Thread_Safety,nn_globals.v) # define NNLS_FETCH() int Thread_Safety=42 # define NNDEBUGLS_FETCH() int Thread_Safety=42 # else # define NNLS_D void # define NNLS_DC # define NNLS_C # define NNLS_CC # define NNG(v) (nn_globals.v) # define NNLS_FETCH() # define NNDEBUGLS_FETCH() # endif #endif I use NNDEBUGLS_FETCH() in the minit function only, because you won't do NNLS_FETCH() there. - Stig

« previous php.version4 (#4852) next »