# Accessing the coroutine context without a call to suspend

**URL:** <https://discuss.kotlinlang.org/t/accessing-the-coroutine-context-without-a-call-to-suspend/5594>\
**Category:** Support\
**Created:** [November 28, 2017, 7:31pm UTC](https://discuss.kotlinlang.org/t/accessing-the-coroutine-context-without-a-call-to-suspend/5594 "2017-11-28T19:31:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fra](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fra/32/4468_2.png) [@fra](https://discuss.kotlinlang.org/u/fra)\
**Post date:** [November 28, 2017, 7:31pm UTC](https://discuss.kotlinlang.org/t/accessing-the-coroutine-context-without-a-call-to-suspend/5594/1 "2017-11-28T19:31:58Z")

</div>

Hi, I’m using something like the following (based on the [auth](https://github.com/Kotlin/kotlin-coroutines/blob/master/examples/context/auth-example.kt) example)

```
class AuthUser(val name: String) : AbstractCoroutineContextElement(AuthUser) {
    companion object Key : CoroutineContext.Key<AuthUser>
}

suspend fun authenticatedUser(): String? = suspendCoroutine { cont ->
    cont.resume(cont.context[AuthUser]?.name)
}

fun main(args: Array<String>) {
    runBlocking(AuthUser("admin")) {
      println(authenticatedUser())
    }
}

```

to provide what I would use a thread local for in a multithread env where one task is associated to one thread and I don’t want to pass contextual information around as a parameter.  
My question is: can I access the coroutine context without suspending? It seems kind of pointless, I’m just using it to get access to the context, I don’t really want to suspend.
