C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mutex fuer Klassen

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
bernd@wiloyee.de
Guest





PostPosted: Sun Apr 04, 2004 2:46 pm    Post subject: Mutex fuer Klassen Reply with quote




Hallo zusammen,

ich moechte gerne folgendes Problem loesen. Wie Kann ich eine Ganze Klasse durch einen Mutex schuetzen. Ich wiss ich kann jede Einzelen funtion durch einen Mutex schuetzen, aber das ist nicht umbedingt das was ich will.
Da ich noch keine Ahnung habe wie ich es loesen soll kann ich nur Pseundocode Posten.

GlobalClasse {
int do1();
double do2();
void do3(int k);
... [ ander functionen ]
}

GlobalClass globaleVariable;

MutexFunction ( ) // Keine Ide wie ich sie implementiren soll

Thread 1
MutexFunction (gobaleVariable)->do1() // aufruf einer beliebigen funktion
Thread 2
MutexFunctiuon (globaleVariable)->do3 // aufruf einer beliebigen funktion

gruss
bernd

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Thomas Maeder
Guest





PostPosted: Sun Apr 04, 2004 7:49 pm    Post subject: Re: Mutex fuer Klassen Reply with quote



[email]bernd (AT) wiloyee (DOT) de[/email] writes:

Quote:
MutexFunction ( ) // Keine Ide wie ich sie implementiren soll

Thread 1
MutexFunction (gobaleVariable)->do1() // aufruf einer beliebigen funktion
Thread 2
MutexFunctiuon (globaleVariable)->do3 // aufruf einer beliebigen funktion

Für diesen Beispielcode würde es reichen, wenn die Memberfunktionen für das
Objekt globaleVariable synchronisiert (im Java-Sinn) sind.

Was brauchst Du also genau:
- Synchronisation je Objekt
- Synchronisation für alle Objekte einer Klasse

?

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.