This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: mutexes again


So I wrote a class for it. In the constructor of the class the mutex
is being initiated (this option can be disabled and later intiated).
My question is:
Are theire performance or other disadvantages to do this so?
An advantage is the implimentation of the cyg_mutex_status() which
returns the status of a mutex and the cyg_mutex_testunlock()

If you mean having an explicit initialization: it is rather hard to design a mutex implementation in which all fields zero is a valid initial state. Mutexes embedded in dynamically allocated data structures could have totally random values. So there is no real option but to expect a mutex to have been initialized before use.

Ok, I think I get that. But what I ment is inside the class constructor, calling the function cyg_mutex_init().


something like this:

class ClMutex{
	public:
	cyg_mutex_t MyMutexVar;

// constructor:
	ClMutex() { cyg_mutex_init(&MyMutexVar); }

......

};

I am not up to a brand new mutex implementation but just simplify the use of it. ;-)

Greetings,
Ronald Tubben
Mauell BV




-- Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]