• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Substitute for kill(2)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Substitute for kill(2)?


  • Subject: Re: Substitute for kill(2)?
  • From: Jack Brindle via Cocoa-dev <email@hidden>
  • Date: Tue, 25 Jul 2023 16:33:47 -0500

I would agree with the use of Distributed Notifications, but there is a new
limitation that was added a few years ago. The receiver must be in the same
login. You can no longer use it to send notifications from one user app to a
different user’s app. This came to light for me when I was trying to send a
notification from a root app to a user app. Fear not, though, there is a form
of Notification that works perfectly for this - CFNotifications. The two, of
course, are closely related, but CFNotifications allow you to use the Darwin
Notification Center which allows cross-user notifications.

These are easy to use, and, I believe, still the best way to send info from one
app to another in the Mac system.

Jack


> On Jul 25, 2023, at 9:38 AM, Rob Petrovec via Cocoa-dev
> <email@hidden> wrote:
>
> NSDistributedNotificationCenter is a way to send a notification out across
> the system. Only processes that are listening for the notification will
> receive it and have a chance to do something with it. It’s like yelling out
> in a crowded room to tell a single person something. Everyone will hear your
> message, but only one will be listening. Make sense?
> https://developer.apple.com/documentation/foundation/nsdistributednotificationcenter?changes=_4&language=objc
>
> But what it really sounds like you want to use XPC (Cross Process
> Communication) for a more targeted messaging (possibly with payloads) between
> your app and menuling.
> https://developer.apple.com/documentation/xpc?language=objc
>
> —Rob
>
>
>> On Jul 25, 2023, at 7:51 AM, Gabriel Zachmann <email@hidden> wrote:
>>
>> Thanks a lot for your responses!
>>
>> Sorry for the misunderstanding: I don't want to kill the other process.
>> (In case you forgot: the kill(2) system call is for sending unix signals to
>> processes, which can listen to those signals (at least, most of them). I
>> just want to signal the other process, not really kill it. So, SIGUSR1
>> would've been my choice, if macOS would allow me to send a signal.)
>>
>> What do you mean by "distributed notification" ?
>> How would I send it?
>>
>> Best regards, Gabriel
>>
>>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Substitute for kill(2)? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Substitute for kill(2)? (From: Alex Zavatone via Cocoa-dev <email@hidden>)
 >Re: Substitute for kill(2)? (From: Rob Petrovec via Cocoa-dev <email@hidden>)
 >Re: Substitute for kill(2)? (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Substitute for kill(2)? (From: Rob Petrovec via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Substitute for kill(2)? (James Walker)
  • Previous by thread: Re: Substitute for kill(2)?
  • Next by thread: Re: Substitute for kill(2)? (James Walker)
  • Index(es):
    • Date
    • Thread