Re: Substitute for kill(2)?

2023-07-25 Thread Jack Brindle via Cocoa-dev
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 t

Re: Substitute for kill(2)? (James Walker)

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
>> > An XPC service isn't an app, and wouldn't you need an app to run an > NSStatusItem, which I assume is what's meant by a "menu bar item"? Oh, sorry, PS: yes, I do create let statusBar = NSStatusBar.system statusBarItem_ = statusBar.statusItem( withLength: NSStatusItem.variableLength

Re: Substitute for kill(2)? (James Walker)

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
>> > An XPC service isn't an app, and wouldn't you need an app to run an > NSStatusItem, which I assume is what's meant by a "menu bar item"? > I am just a beginner in "menu bar items" , but what I have is an @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate which Xcode comp

Re: Substitute for kill(2)?

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
> 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 wil

Re: Substitute for kill(2)?

2023-07-25 Thread James Walker via Cocoa-dev
On 7/25/23 7:38 AM, Rob Petrovec via Cocoa-dev 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

Re: Substitute for kill(2)?

2023-07-25 Thread Rob Petrovec via Cocoa-dev
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 y

Re: Substitute for kill(2)?

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
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

Re: Substitute for kill(2)?

2023-07-25 Thread Rob Petrovec via Cocoa-dev
Yeah, you might be able to send out a distributed notification and have the menuling listen for it. When it receives it it can kill itself or go through the normal teardown/quit procedure. —Rob > On Jul 25, 2023, at 6:15 AM, Alex Zavatone via Cocoa-dev > wrote: > > What if you called a meth

Re: Substitute for kill(2)?

2023-07-25 Thread Alex Zavatone via Cocoa-dev
What if you called a method in the other process and the other process kills itself with a kill? Is kill no longer functional from any process? > On Jul 25, 2023, at 2:49 AM, Gabriel Zachmann via Cocoa-dev > wrote: > > Is there a simple way for one process to send a single signal to another

Substitute for kill(2)?

2023-07-25 Thread Gabriel Zachmann via Cocoa-dev
Is there a simple way for one process to send a single signal to another process? Both processes are my programs, one is a regular app, the other a menu bar item. Both are launched by the same user. In the old unix days, I would have used kill(2) and send a SIGUSR1 , but as far as I understand,