>>>>> "Sunil" == Sunil S <[EMAIL PROTECTED]> writes:
Sunil> Hi every1, If possible could any1 tell me how to
1> .. find if there is an instance
Sunil> of the application developed in C already running i.e check
Sunil> the previous instance of the same application within that
Sunil> application(written in C) 2 > ....find other users in Linux
Sunil> who are using the same application within the
Sunil> application. There may an application that is been run by
Sunil> different users. Each time the other user is executing the
Sunil> application he should get to know that there are x number
Sunil> off other users using it. I need the API('s) which can be
Sunil> included in the C program and not the ps with grep.
Let the apps allocate a piece of shared memory and increment it as a
counter each time an instance starts up, decrement it each time an
instance shuts down.
Of course, that won't handle app crashes. If you want to handle that
situation, use a semaphore. Do a P when you start an instance with
SEM_UNDO set, then the system will automatically do a V when the app
ends (or maybe the other way around, can never remember whether P
increases the semaphore or decreases it).
Semaphores aren't really meant to be counters, though, so retrieving
the absolute value of the semaphore may be difficult (or impossible).
Regards,
-- Raju
--
Raj Mathur [EMAIL PROTECTED] http://kandalaya.org/
GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F
It is the mind that moves
_______________________________________________
ilugd mailing list
[EMAIL PROTECTED]
http://frodo.hserus.net/mailman/listinfo/ilugd