Exemplo n.º 1
0
DirectResult
direct_signals_shutdown( void )
{
     D_DEBUG_AT( Direct_Signals, "Shutting down...\n" );

     remove_handlers();

     direct_mutex_deinit( &handlers_lock );

     return DR_OK;
}
Exemplo n.º 2
0
DirectResult
direct_signals_shutdown( void )
{
     D_DEBUG_AT( Direct_Signals, "Shutting down...\n" );
#ifdef ANDROID_NDK
     remove_handlers();
#else
     if (direct_config->sighandler_thread) {
          if (sighandler_thread) {
               direct_thread_kill( sighandler_thread, SIG_CLOSE_SIGHANDLER );
               direct_thread_join( sighandler_thread );
               direct_thread_destroy( sighandler_thread );
               sighandler_thread = NULL;
          }
     }
     else
          remove_handlers();
#endif
     direct_mutex_deinit( &handlers_lock );

     return DR_OK;
}
Exemplo n.º 3
0
int test_5(duk_context *ctx) {
	duk_set_top(ctx, 0);

	remove_handlers(ctx);
	duk_eval_string(ctx, "Duktape.errCreate = function (err) { err.name = 'ForcedName'; return err; }");

	/* Create (and throw) with duk_error(). */

	duk_error(ctx, 1234567, "arbitrary error code");

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
Exemplo n.º 4
0
int test_1(duk_context *ctx) {
	duk_set_top(ctx, 0);

	remove_handlers(ctx);
	duk_eval_string(ctx, "Duktape.errThrow = function (err) { err.name = 'ForcedName'; return err; }");
	duk_pop(ctx);

	/* Throw with duk_throw(). */

	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "range error: %d", 123);
	duk_throw(ctx);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
Exemplo n.º 5
0
static duk_ret_t test_2(duk_context *ctx, void *udata) {
	(void) udata;

	duk_set_top(ctx, 0);

	remove_handlers(ctx);
	duk_eval_string(ctx, "Duktape.errThrow = function (err) { err.name = 'ForcedName'; return err; }");
	duk_pop(ctx);

	/* Throw with duk_error(). */

	duk_error(ctx, 1234567, "arbitrary error code");

	printf("final top: %ld\n", (long) duk_get_top(ctx));
	return 0;
}
Exemplo n.º 6
0
int test_4(duk_context *ctx) {
	duk_set_top(ctx, 0);

	remove_handlers(ctx);
	duk_eval_string(ctx, "Duktape.errCreate = function (err) { err.name = 'ForcedName'; return err; }");
	duk_pop(ctx);

	/* Create without throwing. */

	duk_push_error_object(ctx, DUK_ERR_RANGE_ERROR, "range error: %d", 123);
	printf("string coerced: %s\n", duk_to_string(ctx, -1));
	duk_pop(ctx);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}
Exemplo n.º 7
0
int test_3(duk_context *ctx) {
	duk_set_top(ctx, 0);

	/* Causes a ReferenceError when error handler runs.  The
	 * ReferenceError replaces the original TypeError.
	 */

	remove_handlers(ctx);
	duk_eval_string(ctx, "Duktape.errThrow = function (err) { zork; }");
	duk_pop(ctx);

	duk_error(ctx, DUK_ERR_TYPE_ERROR, NULL);

	printf("final top: %d\n", duk_get_top(ctx));
	return 0;
}