Re: Inter process Semaphore possible?
From: Vishal Doshi (Vishal.Doshi_at_ntlworld.com)
Date: 07/27/04
- Next message: Headache: "Re: changing GUID on ActiveX control"
- Previous message: Microsoft: "Accelerators in floating windows"
- In reply to: Jack: "Inter process Semaphore possible?"
- Next in thread: Joseph M. Newcomer: "Re: Inter process Semaphore possible?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 27 Jul 2004 14:04:41 GMT
"Jack" <not@home.com> wrote in message
news:41064d6e$0$6448$cc9e4d1f@news-text.dial.pipex.com...
> Hi,
>
> I have several processes each with several threads potetially querying an
> on-line server.
>
> I ish to be able to limit the number of concurrent requests to the server.
>
> Clearly, within a process I can implement some form of semaphore to limit
> the requests per process, but how can I limit the total number of
concurrent
> requests across all processes?
>
> Is an "inter-process semaphore" possible in some way, perhaps through
shared
> memory?
>
Semaphores are named kernel objects. They can be used by many processes at
the same time.
Process A:
HANDLE hSem = CreateSemaphore(..., "Global\\TEST_SEMAPHORE");
Process B:
HANDLE hSem = CreateSemaphore(..., "Global\\TEST_SEMAPHORE");
Both Process A and Process B now have a handle to the same semaphore. Use a
GUID for the name if you want to be relatively sure that no other kernel
object has the same name.
You can hardcode the name in each process, use a shared header file, or
create a DLL which can be loaded into each process.
Vishal.
- Next message: Headache: "Re: changing GUID on ActiveX control"
- Previous message: Microsoft: "Accelerators in floating windows"
- In reply to: Jack: "Inter process Semaphore possible?"
- Next in thread: Joseph M. Newcomer: "Re: Inter process Semaphore possible?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|