suspend

Windows: Atomically suspend an entire process?

冷暖自知 提交于 2019-12-06 02:01:16
Using Win32 API it is only possible to suspend a single thread using SuspendThread() but not a complete process in one call. Iterating over a process threads and suspending them one at a time is not a good option since it may cause dead-locks and unexpected behavior. This is supposed to be something that is possible in kernel using a function from the DDK (which I don't remember its name). How is it possible to expose this function to user mode? Is there any other way to achieve this without going to the kernel? SysInternals process explorer has an option to suspend process. How does it do it?

how to find if the process is suspended or not?

放肆的年华 提交于 2019-12-04 18:43:22
i am using this code for suspend process.i found it here http://www.codeproject.com/KB/threads/pausep.aspx BOOL SuspendResumeThreadList(DWORD dwOwnerPID, bool bResumeThread) { HANDLE hThreadSnap = NULL; BOOL bRet = FALSE; THREADENTRY32 te32 = {0}; hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); if (hThreadSnap == INVALID_HANDLE_VALUE) return (FALSE); te32.dwSize = sizeof(THREADENTRY32); if (Thread32First(hThreadSnap, &te32)) { do { if (te32.th32OwnerProcessID == dwOwnerPID) { HANDLE hThread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te32.th32ThreadID); if (bResumeThread) { //cout

Terminate loopless thread instantly without Abort or Suspend

自作多情 提交于 2019-12-04 16:00:00
I am implementing a protocol library. Here a simplified description. The main thread within the main function will always check, whether some data is available on the the networkstream (within a tcpclient). Let us say response is the received message and thread is a running thread. thread = new Thread(new ThreadStart(function)); thread.IsBackground = true; thread.Start(); while(true){ response = receiveMessage(); if (response != null) { thread.Suspend(); //I am searching for an alternative for the line above and not thread.Abort(). thread2 = new Thread(new ThreadStart(function2)); thread2

App or Code to Suspend Resume UWP app without Visual Studio

我的未来我决定 提交于 2019-12-04 15:45:32
My question is similar to How to make UWP app to suspend and resume state , but I need an application that I can give to my QA team so that they can more easily invoke Suspend and Resume in my app. Since Visual Studio has a "LifeCycle Events" toolbar that lets you suspend and resume your App, I figure that there must be an app that ships with Visual Studio that does this. However, perusing through the Visual Studio files, I was not able to find such an executable. Does anyone know of a stand-alone application (installed with Visual Studio or not) that can suspend or resume a windows store app?

UWP suspend disable with ExtendedExecutionSession or ExtendedExecutionForegroundSession

偶尔善良 提交于 2019-12-04 15:01:27
UWP, I can not be disable to suspend. I need your knowledge. Here is my simple example to know issue. It's counter increase/decrease application. Actually, I want to monitor temperatures from device for 356 x 24 hours without any stopping. I expect to increase value++ during Suspend mode. but UWP does not work during supending.. Why ?? Uploaded code is here at Github.com. You can test My simple application. https://github.com/bidasknakayama/Basic here is my environment. It's desktop PC. Desktop PC or Plugged Note PC ( no battery mode ) Outputed as Sideloaded application Package.appxmanifest <

Pausing a download thread

一世执手 提交于 2019-12-04 14:29:15
I'm writing a very simple bulk download program in c# that reads a .txt file of URLs to download. I've set it up with a global Thread and delegate for updating the GUI, and the pressing of the "Begin" button creates and starts that thread. What I want to do is have a "Pause" button that enables me to pause the download until I hit the "Resume" button. How do I do this? The relevant code: private Thread thr; private delegate void UpdateProgressCallback(int curFile); private void Begin_btn_Click(object sender, EventArgs e) { thr = new Thread(Download); thr.Start(); } private void Pause_btn_Click

UIApplicationExitsOnSuspend anything else I'm missing?

▼魔方 西西 提交于 2019-12-04 12:01:51
问题 So I know this has been beaten to death but I still can't figure out a solution. I have my UIApplicationExitsOnSuspend set to <true/> in the Info.plist and still both in the simulator as well as on an iPhone 4 device, the app goes into standby instead of terminating? Any ideas of what else could one do to get it to terminate? Perhaps are there methods that I need to remove from the app delegate? Any ideas? 回答1: Did you do a clean build, delete the app from both the simulator and the device,

How can I catch a system suspend event in Python?

雨燕双飞 提交于 2019-12-04 06:57:42
I'm using ubuntu 12.04. Is there a way to catch a suspend event in Python, i.e. if the laptop is going to suspend, do this...? The same question for catching shutdown event. i think simplest method would be to use DBUS python interface and listen for 'AboutToSleep' and/or 'Sleeping' event on 'org.freedesktop.UPower' interface If some one stumbles on the same problem, here's the code: #!/usr/bin/env python import dbus # for dbus communication (obviously) import gobject # main loop from dbus.mainloop.glib import DBusGMainLoop # integration into the main loop def handle_resume_callback(): print

Bash date/time arithmetic

我与影子孤独终老i 提交于 2019-12-04 05:27:38
I have a little Bash script which suspends the computer after a given number of minutes. However, I'd like to extend it to tell me what the time will be when it will be suspended, so I can get a rough idea of how long time I have left so to speak. #!/bin/sh let SECS=$1*60 echo "Sleeping for" $1 "minutes, which is" $SECS "seconds." sleep $SECS && pm-suspend The only argument to the script will be how many minutes from now the computer should be suspended. All I want to add to this script is basically an echo saying e.g. "Sleeping until HH:nn:ss!". Any ideas? Found out how. echo "The computer

How does transaction suspension work in MySQL?

走远了吗. 提交于 2019-12-03 15:00:50
In the Spring Framework manual they state that for a PROPAGATION_REQUIRES_NEW the current transaction will be suspended. What does that "suspended transaction"? The timer for the timeout stops counting on the current transaction? What are the actual implication of such suspension? Thank you, Asaf It doesn't mean anything special, a suspended transaction is just a transaction that is temporarily not used for inserts, updates, commit or rollback, because a new transaction should be created due to the specified propagation properties, and only one transaction can be active at the same time.