diff options
author | Andy Green <andy.green@linaro.org> | 2012-10-12 10:53:53 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2012-10-12 10:53:53 +0800 |
commit | e1c9107dfc99a1827db10ee558f59c88113cd000 (patch) | |
tree | d2bcdc99a5d352756779e409c5b343b79aea7c81 | |
parent | 0ed496e702cb52ba5eee23864ba4643c4407824d (diff) |
use semaphore name unique to session
Signed-off-by: Andy Green <andy.green@linaro.org>
-rw-r--r-- | libarmep/service.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libarmep/service.c b/libarmep/service.c index 1fcec1a..c6c5970 100644 --- a/libarmep/service.c +++ b/libarmep/service.c @@ -545,6 +545,7 @@ int aep_init_and_fork(struct aep_context *aep_context) { int n, m, i; struct aep_channel *ch; + char semname[64]; loop = 1; @@ -565,7 +566,9 @@ int aep_init_and_fork(struct aep_context *aep_context) aep_context->aep_shared->head = 0; aep_context->aep_shared->tail = 0; - aep_context->semaphore = sem_open("linaro.aep", O_CREAT | O_RDWR, 0600, 0); + sprintf(semname, "linaro.aep.%u\n", getpid()); + + aep_context->semaphore = sem_open(semname, O_CREAT | O_RDWR, 0600, 0); /* fork off aep service loop */ @@ -578,7 +581,7 @@ int aep_init_and_fork(struct aep_context *aep_context) * fills the named pipe fifo with sample packets */ - aep_context->semaphore = sem_open("linaro.aep", O_CREAT | O_RDWR, 0600, 0); + aep_context->semaphore = sem_open(semname, O_CREAT | O_RDWR, 0600, 0); aep_context->aep_shared->finished = 0; aep_context->poll_timeout_ms = 10; |