![]() |
| | #1 |
| Registered User Join Date: May 2006
Posts: 1,579
| Close of event For ManualResetEvent and AutoResetEvent, I noticed some samples which does not call Close after using them. 1. I think to be of good practices, we should call Close after using them -- the reason is both ManualResetEvent and AutoResetEvent wraps native resources and release immediately will make system have more capability to serve in the future? 2. What native resources are wrapped? thanks in advance, George |
| George2 is offline |
| | #2 |
| the hat of redundancy hat Join Date: Aug 2001 Location: Hannover, Germany
Posts: 2,769
| 1) Yes. Samples are sometimes sloppy. However, you can also reuse an event, if you need one many times, don't new/close one every time. Just reuse the one you already have. If an event will live over the duration of the whole application, it's not neccessary to close it more than once in the end. 2) On a very wild guess, I'd say it's wrapping an event HANDLE created by the CreateEvent-API m-)
__________________ hth -nv She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate." When in doubt, read the FAQ. Then ask a smart question. |
| nvoigt is offline |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Lame null append cause buffer to crash | cmoo | C Programming | 8 | 12-29-2008 03:27 AM |
| open() and close() | SoFarAway | C Programming | 3 | 04-08-2005 01:16 PM |
| XWindows- Close window event? | Exile | Linux Programming | 8 | 01-09-2005 10:39 PM |
| Ghost in the CD Drive | Natase | A Brief History of Cprogramming.com | 17 | 10-12-2001 05:38 PM |