Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Incrementing Semaphores on process termination
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
nrieger  
View profile  
 More options Aug 2 2005, 10:00 am
Newsgroups: microsoft.public.win32.programmer.kernel
From: "nrieger" <nrie...@discussions.microsoft.com>
Date: Tue, 2 Aug 2005 07:00:05 -0700
Local: Tues, Aug 2 2005 10:00 am
Subject: Incrementing Semaphores on process termination
Hi,

I'm using several semaphores (max val 1) for IPC:

hnd = CreateSemaphore (NULL, 1, 1, "SEM-1");
....
result = WaitForSingleObject(hnd, INFINITE);

If a process is killed or stopped while it holds the semaphore (val=0), the
semaphore is not incremented by Windows (process cleanup ?).

Doesn't windows cleanup (increment semaphore by process' descrements) on
process termination ?

I'm using Windows XP, 2000, 2003 Server, each process is a "console
Application" developed with VC++ 6.0.
Each assistance is welcome and appreciated.
Thanx a lot.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Terrence  
View profile  
 More options Aug 2 2005, 2:48 pm
Newsgroups: microsoft.public.win32.programmer.kernel
From: "Terrence" <a...@123.xyz>
Date: Tue, 2 Aug 2005 11:48:25 -0700
Local: Tues, Aug 2 2005 2:48 pm
Subject: Re: Incrementing Semaphores on process termination
If you need to know that a process was terminated, get the HANDLE for the
process and use that to wait.

Instead of using a semaphore with count 1, use a mutex, because
WAIT_ABANDONED will be returned in the event that the mutex-holder is
terminated.

A semaphore is not "held" like a mutex is held.  It is just a
waitable-atomic-counter.

"nrieger" <nrie...@discussions.microsoft.com> wrote in message

news:A77D8544-DD8F-4EC6-A6B9-565B6C0158D3@microsoft.com...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
nrieger  
View profile  
 More options Aug 3 2005, 8:40 am
Newsgroups: microsoft.public.win32.programmer.kernel
From: "nrieger" <nrie...@discussions.microsoft.com>
Date: Wed, 3 Aug 2005 05:40:38 -0700
Local: Wed, Aug 3 2005 8:40 am
Subject: Re: Incrementing Semaphores on process termination
Thanx a lot,
I changed from semaphore to mutex. Works fine, thanx a lot.
I thought mutex is only used for thread sync (like critical sections),
didn't know
that they can be used across processes.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »