[haiku-commits] Re: r34395 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/sys

Ingo Weinhold schrieb:
On 2009-12-01 at 15:51:56 [+0100], Colin Günther <coling@xxxxxx> wrote:
Ingo Weinhold schrieb:
On 2009-11-30 at 23:27:02 [+0100], coling@xxxxxx wrote:
Author: colin
Date: 2009-11-30 23:27:02 +0100 (Mon, 30 Nov 2009)
New Revision: 34395
Changeset: http://dev.haiku-os.org/changeset/34395/haiku
[...]
Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/condvar.h
===================================================================
--- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/condvar.h
2009-11-30 22:07:16 UTC (rev 34394)
+++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/condvar.h
2009-11-30 22:27:02 UTC (rev 34395)
@@ -10,7 +10,7 @@
struct cv {
-    int cv_waiters;
+    int dummy;
 };
It's still not much clearer to me, why you use this structure.
The "struct cv"  is needed to stay source compatible with FreeBSD wlan
stack. For example
http://dev.haiku-os.org/browser/haiku/trunk/src/libs/compat/freebsd_wlan/net80211/ieee80211_scan.c#L62
this structure is defined and used throughout this file.

I didn't mean the structure as such,
Ah..., ok.
but how it is defined now. The first version, containing the ConditionVariable pointer seemed to be the most useful one IMO.
Yes, but the problem with this version was that the wlan stack doesn't call _cv_destroy to gracefully free this resource again. The FreeBSD implementation of conditional variables allows to delete a conditional variable without a prior call to cv_destroy. But I think I found a way to change my implementation so that uninit_conditional_variables() will be superflous.
Unless you
really need uninit_condition_variables() to destroy condition variables
--
which doesn't look like it from what I see --
Mmh, so I thought

while (variable != NULL) {
    ConditionVariable* next = definition.GetLink(variable);
    variable->Unpublish();
    delete variable;


in uninit_condition_variables() destroys the ConditionVariables. Do I
miss something here?

It does (ignoring the fact that you still use Unpublish() on condition variables that haven't been Publish()ed in the first place), but that is not
Hey every conditionVariable I create in _cv_init() gets published since r34395 (You got heared over here :)

+       conditionVariable->Publish(object, description);


[...]

and just use
ConditionVariable pointers), and add static versions of the
ConditionVariable::Notify{One,All}() methods that take the identifying
object as first parameter.
Do you mean I should add static versions of
ConditionVariable::Notify{One,All}() methods to Haiku's
condition_variable.{h,cpp} ? I don't see such versions in the current
source, at least.

Exactly.

I will do that.
CU, Ingo



Other related posts: