Page 1 of 1

Handle tasks

Posted: Mon Dec 12, 2005 12:00 am
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,

Re: Handle tasks

Posted: Mon Dec 12, 2005 12:00 am
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