Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Foundation Tool

Foundation Tool
Thread Tools
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
May 14, 2003, 03:32 AM
 
Hey all,

Ive been messing with cocoa for about a year now, and ive got a pretty good handle on it. then today I decided I would try my hand at a "Foundation Tool" or a command line tool. Whoa different world.

Im sure that what Im trying to do is VERY trivial (or perhaps not?) but I know it would only be a couple of lines in cocoa obj c. Anyway...


What Im trying to do is write a tool that when run, reports its pid and just keeps on running, waiting for a sighup. when it gets one, it executes some other method. After the other method completes, it returns the value and keeps waiting for sighups. It would be nice if it responded to sigints to quit.

I plan to run this tool with NSTask from another cocoa app.

I think the key to getting it to keep running is "the run loop" but I dont really even know where to begin.

I was going to use distributed notifications instead of sighups/sigints but I thought it would be overkill. Can some kind soul point me at some source or perhaps even post some here?

Your help is greatly appreciated.
(Last edited by 3R1C; Nov 10, 2003 at 10:05 PM. )
3R1C
     
Mac Enthusiast
Join Date: Jul 2002
Location: Leiden, Netherlands
Status: Offline
Reply With Quote
May 14, 2003, 07:01 AM
 
Originally posted by 3R1C:
Hey all,
I was going to use distributed notifications instead of sighups/sigints but I thought it would be overkill. Can some kind soul point me at some source or perhaps even post some here?

Your help is greatly appreciated.
check this out.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 14, 2003, 07:51 PM
 
Originally posted by 3R1C:
I think the key to getting it to keep running is "the run loop" but I dont really even know where to begin.
Take a look at the documentation for NSRunLoop. It provides basically everything you need to know about setting up a run loop in Cocoa. All you need to do is have your run loop going and use a signal handler like Ludovic's example demonstrates, and you'll have it cinched.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:33 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2