Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Windows have no DeleteConditionVariable() function to go together with InitializeConditionVariable()?

I'm trying out Windows support for Condition Variables today (as provided by Microsoft for Windows Vista and later). To initialize a condition variable, I call InitializeConditionVariable(), which is straightforward enough, but I don't see any way provided to destroy the condition variable when I'm done using it. Why is there no DeleteConditionVariable() function?

(I'd expect the API to be analogous to the existing CreateCriticalSection() / DestroyCriticalSection() API)

like image 213
Jeremy Friesner Avatar asked Mar 10 '15 23:03

Jeremy Friesner


1 Answers

A conditional variable is a very light-weight object that is internally based on a single global kernel keyed event object that is always available through every process's entire lifetime. The conditional variable simply contains a pointer to that object. So there is nothing that needs to be freed explicitly, thus no delete function is needed.

like image 60
Remy Lebeau Avatar answered Oct 12 '22 21:10

Remy Lebeau