开发者

Can't think of a good name for this customized event class [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

First, I wrote 开发者_运维技巧a class which wraps a Windows API Event (using Wait to wrap WaitForSingleObject, Set() to wrap SetEvent(), etc). I called it CEvent and was satisfied.

Now I created a class which extends CEvent, adding the functionality to count how many times the event was set, and expose that value with a getCount() property. With this, clients can perform as many Wait()'s as Set()'s.

Two questions, actually:

  1. This sounds like some special synchronization construct I recall studying in my Concurrent Programming class, but that was ages ago and I'm not sure. Anybody knows if this is so, and if it is, how is this construct called?

  2. I named my class CCountedEvent. Is this a good name?


An old saying is "a class does not do something, it is something". In that context, CEvent might be a good name, but only if an object of the class is an event (which I doubt).

I would suggest using EventHandler and CountingEventHandler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜