Questions tagged [suspend]

469 questions
2
votes
3 answers

How to synchronize shared data between threads by using pause then resume or alternatives

I'm writing a game in which a thread - GameThread - loops forever, updating all my sprites, rendering them, and then sleeping for some time before doing it all again. I also have a custom-made Event handler which deals with key presses etc. This all…
user1299784
  • 2,019
  • 18
  • 30
2
votes
1 answer

Suspend process if writing at a specific address

On Windows (preferably XP) is it generally possible to suspend a process when it is writing at a specific address (in it's virtual address space) ? The problem is complicated by the fact that loaded DLLs perform the write operation and not code in…
ktx
  • 168
  • 11
2
votes
1 answer

Suspend and resume F# asynchronous workflows (Async<'T>)

Is there a general way to gain external control over the execution of an arbitrary asynchronous workflow, for suspension and resumption? Akin to a CancellationToken but more like a SuspendResumeToken where one could simply do things like: let…
Bent Rasmussen
  • 5,538
  • 9
  • 44
  • 63
2
votes
1 answer

Do suspend functions suspend coroutines?

I am confused actually. for example, I know suspendCoroutine function which is a suspend function that suspends a coroutine. but do all suspend functions suspend coroutines? in addition I know when a coroutine is suspended it remove from the…
2
votes
1 answer

What happens when a function is suspended. During the suspension, where does the "suspend" function go

Please explain What happened with a function getting suspended where suspended function go during the suspension How the communication happens to resume the suspended function Who is responsible to take care of the suspend function mechanism Thank…
Ashish Dwivedi
  • 8,048
  • 5
  • 58
  • 78
2
votes
1 answer

How to get pid from identical running processes and pipe the output into if statement

I want the script to find two identical processes that are currently running and pipe the PID of the process that matches a defined path in the variable $procName by using the If($_.Path -eq $procName){ command. After the correct process has been…
slyfox1186
  • 301
  • 1
  • 13
2
votes
1 answer

SystemEvents and resuming from sleep

Imagine I was creating an application that measured how long a certain user is logged in to a computer (the actual application I'm writing is different, but that doesn't matter). I need to track when the user logs in, logs out, when he suspends the…
svick
  • 236,525
  • 50
  • 385
  • 514
2
votes
1 answer

If I write blocking code inside a Kotlin coroutine will it still block the thread?

This question arose after extensive discussion with a coworker, The issue is the following: what I was doing before calling a synchronous method inside a suspendCoroutine block with continuation: private suspend fun request(queryRequest:…
2
votes
0 answers

What is the internal of suspending a Linux process?

I am trying to test suspend a specific process in Linux-5.8.18. I wrote modified kernel to export freeze_task() (and also removed basic checking from it) as follows, spin_lock_irqsave(&freezer_lock, flags); if (!(p->flags & PF_KTHREAD)) …
wangt13
  • 959
  • 7
  • 17
2
votes
1 answer

Flutter app continues running in background and causes unwanted battery drain

I am developing a Flutter app that is meant to be used to control IoT devices that are connected to the local network. Unfortunately, while testing the app, I have experienced the following issue: According to the iOS settings app, the app is…
ThePC007
  • 41
  • 5
2
votes
1 answer

Windows CE: Wakeup device when USB power on

I've got a navigation device (Wayteq x850) that's running Windows CE 5.0. It serves as USB client to another device. Is there a (simple) way to wake up the USB client from Suspend when the USB connection is established, or when power comes from the…
Hinton
  • 2,320
  • 4
  • 26
  • 32
2
votes
1 answer

Suspend function reference as parameter of let gets error

Why Kotlin can't reference to suspend function as the parameter of let/also and other functions? class X fun a(x: X) {} suspend fun b(x: X) {} X().let(::a) X().let(::b) // Error: Type mismatch
Zouyiu Ng
  • 193
  • 1
  • 12
2
votes
3 answers

Check if row is inserted into Room database

I am inserting rows into Room database and I want to check if the row is inserted successfully. This is my Dao @Insert() suspend fun insertOfflineData(offlineData: OfflineData): Long @Entity data class OfflineData( @PrimaryKey(autoGenerate =…
BRDroid
  • 3,920
  • 8
  • 65
  • 143
2
votes
1 answer

Are Kotlin suspend functions blocking?

Code: suspend fun main() { println("main start") f1() println("main end") } suspend fun f1() { println("f1 start") delay(2_000) println("f1 end") } Actual Output: main start f1 start f1 end main end My expected output main…
Abhay P
  • 107
  • 7
2
votes
0 answers

Is it possible to set up jupyter notebook so that it is usable after suspend/sleep

I use Jupyter notebook a lot on my laptop. It all works well until I suspend/sleep the laptop. When the laptop wakes up the notebooks are no longer usable. I guess this is because the kernel hasn't been revived? Is it possible to set up Jupyter…
Simd
  • 19,447
  • 42
  • 136
  • 271