I have this click Button handler (MonoMac on OS X 10.9.3):
partial void OnDoButtonClick(NSObject sender) { DoButton.Enabled = false; // Start animation ProgressIndicator.StartAnimation(this); ThreadPool.QueueUserWorkItem(_ => { // Perform a task that last for about a second: Thread.Sleep(1 * 1000); // Stop animation: InvokeOnMainThread(() => { ProgressIndicator.StopAnimation(this); DoButton.Enabled = true; }); }); }
However, when I run the code by clicking the button, the main thread stops the following error:
(lldb) quit * thread # 1: tid = 0x2bf20, 0x98fd9f7a libsystem_kernel.dylib`mach_msg_trap + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
And in the system log, the following log is written:
2014/05/21 13:10:51.752 com.apple.debugserver-310.2[3553]: 1 +0.000001 sec [0de1/1503]: error: ::read ( 0, 0x107557a40, 1024 ) => -1 err = Connection reset by peer (0x00000036) 2014/05/21 13:10:51.752 com.apple.debugserver-310.2[3553]: 2 +0.000001 sec [0de1/0303]: error: ::ptrace (request = PT_THUPDATE, pid = 0x0ddc, tid = 0x1a03, signal = -1) err = Invalid argument (0x00000016) 2014/05/21 13:10:51.753 com.apple.debugserver-310.2[3553]: Exiting. 2014/05/21 13:11:05.000 kernel[0]: process <AppName>[3548] caught causing excessive wakeups. Observed wakeups rate (per sec): 1513; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 45061 2014/05/21 13:11:05.302 ReportCrash[3555]: Invoking spindump for pid=3548 wakeups_rate=1513 duration=30 because of excessive wakeups 2014/05/21 13:11:07.452 spindump[3556]: Saved wakeups_resource.spin report for <AppName> version 1.2.1.0 (1) to /Library/Logs/DiagnosticReports/<AppName>_2014-05-21-131107_<UserName>-MacBook-Pro.wakeups_resource.spin
Top Extract: Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 45061 Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 45061
The problem does not occur if I delete the lines ProgressIndicator.StartAnimation(this); and ProgressIndicator.StopAnimation(this); .
Why is the main thread stopped by SIGSTOP?
source share