//export swift_io_v_v23_context_VContext_nativeWithDeadline func swift_io_v_v23_context_VContext_nativeWithDeadline(ctxHandle C.GoContextHandle, deadlineEpoch C.double, errOut C.SwiftVErrorPtr) C.GoCancelableContextHandle { ctx := GoContext(uint64(ctxHandle)) deadline := sutil.GoTime(float64(deadlineEpoch)) ctx, cancelFunc := context.WithDeadline(ctx, deadline) swiftCtx, err := SwiftCancelableContext(ctx, cancelFunc) if err != nil { sutil.ThrowSwiftError(ctx, err, unsafe.Pointer(errOut)) return C.GoCancelableContextHandle(0) } return C.GoCancelableContextHandle(swiftCtx) }
//export Java_io_v_v23_context_VContext_nativeWithDeadline func Java_io_v_v23_context_VContext_nativeWithDeadline(jenv *C.JNIEnv, jVContext C.jobject, goRef C.jlong, jDeadline C.jobject) C.jobject { env := jutil.Env(uintptr(unsafe.Pointer(jenv))) deadline, err := jutil.GoTime(env, jutil.Object(uintptr(unsafe.Pointer(jDeadline)))) if err != nil { jutil.JThrowV(env, err) return nil } ctx, cancelFunc := context.WithDeadline((*context.T)(jutil.GoRefValue(jutil.Ref(goRef))), deadline) jCtx, err := JavaContext(env, ctx, cancelFunc) if err != nil { jutil.JThrowV(env, err) return nil } return C.jobject(unsafe.Pointer(jCtx)) }