File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import aws.sdk.kotlin.crt.util.ShutdownChannel
1111import aws.sdk.kotlin.crt.util.shutdownChannel
1212import kotlinx.cinterop.*
1313import libcrt.*
14+ import cnames.structs.aws_event_loop_group
1415
1516/* *
1617 * Creates a new event loop group for the I/O subsystem to use to run blocking I/O requests
@@ -32,13 +33,19 @@ public actual class EventLoopGroup actual constructor(maxThreads: Int) :
3233 private val channelStableRef = StableRef .create(shutdownCompleteChannel)
3334
3435 init {
35- val shutdownOpts = cValue< aws_shutdown_callback_options> {
36- shutdown_callback_fn = staticCFunction(::onShutdownComplete)
37- shutdown_callback_user_data = channelStableRef.asCPointer()
38- }
36+ ptr = memScoped {
37+ val shutdownOpts = cValue< aws_shutdown_callback_options> {
38+ shutdown_callback_fn = staticCFunction(::onShutdownComplete)
39+ shutdown_callback_user_data = channelStableRef.asCPointer()
40+ }
41+
42+ val eventLoopGroupOpts = cValue< aws_event_loop_group_options> {
43+ shutdown_options = shutdownOpts.ptr
44+ }
3945
40- ptr = checkNotNull(aws_event_loop_group_new_default(Allocator .Default , maxThreads.toUShort(), shutdownOpts)) {
41- " aws_event_loop_group_new_default()"
46+ checkNotNull(aws_event_loop_group_new(Allocator .Default , eventLoopGroupOpts)) {
47+ " aws_event_loop_group_new()"
48+ }
4249 }
4350 }
4451
You can’t perform that action at this time.
0 commit comments