
static JSValue js_fileio_protect(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
	JSFileIOCtx *ioctx = JS_GetOpaque(this_val, fileio_class_id);
	if (!ioctx) return JS_UNDEFINED;
	if (!ioctx->factory->lock) {
		ioctx->factory->lock = GF_TRUE;
		ioctx->factory->all_refs++;
	}
	return JS_UNDEFINED;

static JSValue js_fileio_protect(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
	JSFileIOCtx *ioctx = JS_GetOpaque(this_val, fileio_class_id);
	if (!ioctx) return JS_UNDEFINED;
	if (!ioctx->factory->lock) {
		ioctx->factory->lock = GF_TRUE;
		ioctx->factory->all_refs++;
	}
	return JS_UNDEFINED;