Check-in [65a6138eb6]
Overview
Comment:Updated to not continue to reset interpreters forever after a restart request
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 65a6138eb63feb3218475f6feaad8ae71ecb8cc2
User & Date: rkeene on 2014-11-11 17:48:05
Other Links: manifest | tags
Context
2014-11-11
18:38
Added a CPIO input mode for "appfs-mkfs" check-in: 5bdc276f57 user: rkeene tags: trunk
17:48
Updated to not continue to reset interpreters forever after a restart request check-in: 65a6138eb6 user: rkeene tags: trunk
17:43
Added support for hot-restart of AppFSd on SIGUP check-in: b6ea13d9c3 user: rkeene tags: trunk
Changes

Modified appfsd.c from [2fbbb1d1a2] to [65feda12d8].

253
254
255
256
257
258
259

260


261
262
263
264
265
266
267


268
269
270
271
272
273
274
/*
 * Return the thread-specific Tcl interpreter, creating it if needed
 */
static Tcl_Interp *appfs_TclInterp(void) {
	Tcl_Interp *interp;
	int pthread_ret;
	static __thread int thread_interp_reset_key = 0;




	interp = pthread_getspecific(interpKey);
	if (interp != NULL && thread_interp_reset_key != interp_reset_key) {
		APPFS_DEBUG("Terminating old interpreter and restarting due to reset request.");

		Tcl_DeleteInterp(interp);

		interp = NULL;


	}

	if (interp == NULL) {
		interp = appfs_create_TclInterp(NULL);

		if (interp == NULL) {
			return(NULL);







>

>
>

|





>
>







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/*
 * Return the thread-specific Tcl interpreter, creating it if needed
 */
static Tcl_Interp *appfs_TclInterp(void) {
	Tcl_Interp *interp;
	int pthread_ret;
	static __thread int thread_interp_reset_key = 0;
	int global_interp_reset_key;

	global_interp_reset_key = __sync_fetch_and_add(&interp_reset_key, 0);

	interp = pthread_getspecific(interpKey);
	if (interp != NULL && thread_interp_reset_key != global_interp_reset_key) {
		APPFS_DEBUG("Terminating old interpreter and restarting due to reset request.");

		Tcl_DeleteInterp(interp);

		interp = NULL;

		thread_interp_reset_key = global_interp_reset_key;
	}

	if (interp == NULL) {
		interp = appfs_create_TclInterp(NULL);

		if (interp == NULL) {
			return(NULL);