Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / March 2008



Tip: Looking for answers? Try searching our database.

Newbie: Application Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rodmc - 09 Mar 2008 21:28 GMT
Hi,

I have written a small application in Python which seems to run ok,
however I need to make sure that it continue to run even when the
screensaver kicks in - at present it seems to go to sleep. Is there a
way to ensure an application always runs? At the moment it is simply a
standard application.

I am also learning Cocoa and Objective-C right now if that helps.

Thanks in advance.

rod
Gregory Weston - 09 Mar 2008 21:49 GMT
In article
<b871658c-a69f-42c1-83dd-b8398e9415ae@e60g2000hsh.googlegroups.com>,

> Hi,
>
[quoted text clipped - 5 lines]
>
> I am also learning Cocoa and Objective-C right now if that helps.

Screen savers don't generally block other applications. What leads you
to believe that your app "goes to sleep?" Is it possibly just running
slower because whatever screen saver you've got selected is just a bit
too powerful for your machine? Are you sure the whole machine isn't
going to sleep (is there really a screen saver obviously running or are
you just seeing a black screen)?
rodmc - 11 Mar 2008 18:30 GMT
> Screen savers don't generally block other applications. What leads you
> to believe that your app "goes to sleep?" Is it possibly just running
> slower because whatever screen saver you've got selected is just a bit
> too powerful for your machine? Are you sure the whole machine isn't
> going to sleep (is there really a screen saver obviously running or are
> you just seeing a black screen)?

Thanks for your reply. It's one aspect which seems to fail. Basically
it a module which is responsible for the bulk uploading of files and
it relies on an FTP connection. It seems the FTP connection is dropped
when the screensaver kicks in, or the system is out of use for a
while. It's odd I had similar problems with network reliant software
on an iBook sometime ago.

Best,

rod
David Phillip Oster - 12 Mar 2008 04:52 GMT
In article
<94273c32-3db2-4a5f-8741-4f14a332acd0@h11g2000prf.googlegroups.com>,

> > Screen savers don't generally block other applications. What leads you
> > to believe that your app "goes to sleep?" Is it possibly just running
[quoted text clipped - 9 lines]
> while. It's odd I had similar problems with network reliant software
> on an iBook sometime ago.

NSURLConnection by default is only registered in the default runloop
mode. If you want it to run when a screen saver is up, you need to
either be running in a separate thread, or use the 10.5 only calls to
specify which runloop modes are OK for it.
Gregory Weston - 12 Mar 2008 12:53 GMT
> In article
> <94273c32-3db2-4a5f-8741-4f14a332acd0@h11g2000prf.googlegroups.com>,
[quoted text clipped - 17 lines]
> either be running in a separate thread, or use the 10.5 only calls to
> specify which runloop modes are OK for it.

Can you expand on that, or provide a pointer to more detail? I wasn't
aware that the screen saver invoking would trigger a change in the run
loop mode of other apps and haven't so far found details or even
confirmation via Google.
rodmc - 12 Mar 2008 22:24 GMT
> Can you expand on that, or provide a pointer to more detail? I wasn't
> aware that the screen saver invoking would trigger a change in the run
> loop mode of other apps and haven't so far found details or even
> confirmation via Google.

Thanks to both of you for answering my initial question. Will this
also apply in a Python app?

best,

rod
Gregory Weston - 13 Mar 2008 09:17 GMT
In article
<9520868e-f28f-4bd3-b440-acc8fdbe41bd@e25g2000prg.googlegroups.com>,

> > Can you expand on that, or provide a pointer to more detail? I wasn't
> > aware that the screen saver invoking would trigger a change in the run
[quoted text clipped - 3 lines]
> Thanks to both of you for answering my initial question. Will this
> also apply in a Python app?

Unless the interpreter goes out of its way to notice that
ScreenSaverEngine is running and modify its behavior on its own, yes. A
process is a process. The language doesn't really change anything
fundamental about how it interacts with other processes.
rodmc - 19 Mar 2008 13:05 GMT
> In article
> <9520868e-f28f-4bd3-b440-acc8fdbe4...@e25g2000prg.googlegroups.com>,
[quoted text clipped - 11 lines]
> process is a process. The language doesn't really change anything
> fundamental about how it interacts with other processes.

Fair point, and thanks for your help. I actually managed to trace what
I think is the problem to the use of the Python OS module, in
particular commands to move, copy or remove files. When run outside a
threading environment they are ok, however the minute they are inside
a thread things seem to go wrong - even when a lock is applied.

Rod
David Phillip Oster - 13 Mar 2008 02:51 GMT
> > NSURLConnection by default is only registered in the default runloop
> > mode. If you want it to run when a screen saver is up, you need to
[quoted text clipped - 5 lines]
> loop mode of other apps and haven't so far found details or even
> confirmation via Google.

Yes: I was wrong about screensavers having any effect. I wrote a Cocoa
test program:

@implementation AppDelegate

- (void)awakeFromNib {
 [[NSTimer scheduledTimerWithTimeInterval:1. target:self
selector:@selector(fired:) userInfo:nil repeats:YES] retain];
}

- (void)fired:(NSTimer *)timer {
 NSLog(@"%@", [NSDate date]);
}

@end

Ran it, put up a screen saver, typed my username/password into the auth
dialog box to clear the screen saver, and checked the log.

No calls to NSLog were dropped. The presence or absence of a screen
saver does NOT affect the default run loop mode of the front application.

But, the test program will block the timer if you hold down the mouse
button while the mouse cursor is in the app's menu bar.

And, NSURLConnection will similarly pause, unless you use the new 10.5
calls to affect its runloop mode.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.