Handle tasks

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
canario
Posts: 2
Joined: Mon Dec 12, 2005 12:00 am

Handle tasks

Post by canario »

Hi,

I'm not an OS developer (I wish), but I got a question. Been around for some time, but is now that I feel completely stacked, when I thought that probably anyone of you could help.

I use Linux, and program through traditional c language.

Lately, I've been looking for info on how to develop an app. that's gonna run as a single instance within the system, but whose behaviour could be changed when trying to execute the program (supossing there is an existing instance already out there), like this:

program_name [1st_arg]

So, whether the app. is not running it will initializate itself. When tried to execute and an instance was already running, the app. will catch the first argument (if any), pass it through a function, and exit.

AFAIK, what I should make use of is sempahores and threads, despite of the fact that I haven't found a proper linux specific tutorial where this is done.

Am I right?, is this the proper way of doing this? or there are others procedures taken under this circumstances?

Any commens about would be much appreciated.

Kind Regards,
Da_Maestro
Member
Member
Posts: 144
Joined: Tue Oct 26, 2004 11:00 pm
Location: Australia

Re: Handle tasks

Post by Da_Maestro »

So, you want a program that will only allow one instance of itself? Attempting to run another instance will instead pass the parameter to the first instance?

This forum is an OS Dev forum :-p
We are way to hardcore for a question like this hehe

Adam
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
Post Reply