Re: how can i create an simple event under c#
From: Paul G. Tobey [eMVP] (ptobey_no_spam_at_instrument_no_spam.com)
Date: 06/08/04
- Next message: Javier Ros: "Re: Enum processes, kill a process"
- Previous message: Joe Thompson: "SmartPhone emulator"
- In reply to: Elmar Jacobs: "how can i create an simple event under c#"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Jun 2004 08:56:39 -0700
Well, you could P/Invoke directly to those API calls. I'm sure that the
method signatures for WaitForSingleObject and CreateEvent have been posted.
As I recall, SetEvent isn't actually an API call, but maps to ModifyEvent
with suitable arguments.
You can search the archived posts here:
Further, the OpenNETCF SDF has the declaration for WaitForSingleObject in
process.cs. CreateEvent is declared in core.cs. SetEvent/ResetEvent have
also been defined in core.cs to handle setting or clearing the event state
for you.
Events don't carry data. Maybe you should tell us what you're really trying
to do. There might be a significantly better way...
Paul T.
"Elmar Jacobs" <elmar.jacobs@target-instruments.com> wrote in message
news:OGLfqfWTEHA.1544@TK2MSFTNGP09.phx.gbl...
> hi folk,
>
> i have 2 threads an i want to create an event, so that thread1 can inform
> thread2 about an update.
> in c++ i would make it over
>
> HANDLE hEvent = INVALID_HANDLE_VALUE;
> in thread1
> {...
> SetEvent(hEvent);
> ....
> }
>
> and in thread2
> DWORD WINAPI Thread1(PVOID pArg)
> {
> ... WaitForSingleObject(hEvent, INFINITE);
>
> .....
> }
>
>
> but under c# i have no idea how i can realise it. If it is possible that
the
> event can carry an data byte, it was perfect.
> Can anybody help me?
>
> thanks a lot,
> elmar
>
>
- Next message: Javier Ros: "Re: Enum processes, kill a process"
- Previous message: Joe Thompson: "SmartPhone emulator"
- In reply to: Elmar Jacobs: "how can i create an simple event under c#"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|