tutorials.de Buch-Aktion 05/2012
ERLEDIGT
JA
ANTWORTEN
2
ZUGRIFFE
3612
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    t0b1 t0b1 ist offline Mitglied
    Registriert seit
    Mar 2006
    Ort
    Limbim ^^
    Beiträge
    10
    Hallo,
    ich muss gleich gestehn: Ich hab kein Plan, was CLR ist...
    auf jeden Fall habe ich eine anwendung, die das Dateisystem durchsucht und dabei diverse sachen analysiert. Auf jeden fall ist das rel. rechenaufwändig und dauert.

    Nach ca. 60 Sekunden kommt dann eine Fehlermeldung :
    Die CLR konnte 60 Sekunden lang keinen Übergang vom COM-Kontext 0x1a1520 zum COM-Kontext 0x1a1690 durchführen. Der Thread, der Besitzer des Zielkontexts/-apartments ist, wartet entweder, ohne Meldungen zu verschieben, oder verarbeitet eine äußerst lang dauernde Operation, ohne Windows-Meldungen zu verschieben. Eine solche Situation beeinträchtigt in der Regel die Leistung und kann sogar dazu führen, dass die Anwendung nicht mehr reagiert oder die Speicherauslastung immer weiter zunimmt. Zur Vermeidung dieses Problems sollten alle STA-Threads (Singlethread-Apartment) primitive Typen verwenden, die beim Warten Meldungen verschieben (z.B. CoWaitForMultipleHandles), und bei lange dauernden Operationen generell Meldungen verschieben.


    Oke... da ich noch ein ziemlicher newbie bin, hab ich auch kein Plan was STA sein soll und wie man das benutzt....
    könnt ihr mir bitte helfen?

    Danke
    t0b1
     
    ____________________________________
    coding vb.net | asp.net | other stuff
    A sensless but funny non-coders-page:
    visit http://t0b1.rootzilla.de

  2. #2
    Avatar von Christian Kusmanow
    Christian Kusmanow Christian Kusmanow ist offline Mitglied Diamant
    Registriert seit
    Aug 2004
    Ort
    Aachen (NRW)
    Beiträge
    2.208
    Blog-Einträge
    15
    STAs stellen virtuelle Prozesse dar, in denen alles der Reihe nach abgearbeitet wird.
    MTAs hingegen arbeiten jeden Vorgang in einen eigenen Prozess ab. Das muss dementsprechend synchronisieren...

    Aber google doch gleich am besten mal nach "sta mta msdn". Der erste Link ist ne PPT die Dich aufklärt.
    Hier noch ein Auszug aus
    Zitat Zitat von http://blogs.msdn.com/cbrumme/archive/2004/02/02/66219.aspx
    Single Threaded Apartment (STA) – one affinitized thread is used to call all the objects residing in the apartment. Any call on these objects from other threads must perform cross-thread marshaling to this affinitized thread, which dispatches the call. Although a process can have an arbitrary number of STAs (with a corresponding number of threads), most client processes have a single Main STA and the GUI thread is the affinitized thread that owns it.

    Multiple Threaded Apartment (MTA) – each process has at most one MTA at a time. If the current MTA is not being used, OLE may tear it down. A different MTA will be created as necessary later. Most people think of the MTA as not having thread affinity. But strictly speaking it has affinity to a group of threads. This group is the set of all the threads that are not affinitized to STAs. Some of the threads in this group are explicitly placed in the MTA by calling CoInitializeEx. Other threads in this group are implicitly in the MTA because the MTA exists and because these threads haven’t been explicitly placed into STAs. So, by the strict rules of OLE, it is not legal for STA threads to call on any objects in the MTA. Instead, such calls must be marshaled from the calling STA thread over to one of the threads in the MTA before the call can legally proceed.
    Mit
    Code csharp:
    1
    2
    
    [STAThread]
    static void Main(){}
    legst fest, dass dein Progamm in einem SingleThread-Apartment laufen soll.
    Geändert von Christian Kusmanow (02.06.06 um 21:36 Uhr)
     
    MfG,
    Christian

    Wer sein Problem definiert, hat es schon halb gelöst!

    Bitte markiert eure Themen als erledigt. Sonst macht so ein Forum als Nachschlagewerk keinen Sinn.

    The Code Project! - C# Programming | C# / VB.NET Pendants

    Regeln + Netiquette

    Liebe FIAEs, verlasst euch nicht auf das was in der Berufsschule "vermittelt" wird
    und vor allem nicht auf das, was euch die IHK dazu erzählt!
    Die haben so viel Ahnung von dem Gewerk, wie der Bundestag vom Haushalt...

  3. #3
    t0b1 t0b1 ist offline Mitglied
    Registriert seit
    Mar 2006
    Ort
    Limbim ^^
    Beiträge
    10
    vielen dank
     
    ____________________________________
    coding vb.net | asp.net | other stuff
    A sensless but funny non-coders-page:
    visit http://t0b1.rootzilla.de

Ähnliche Themen

  1. Problem mit Thread
    Von arkel im Forum .NET Windows Forms
    Antworten: 2
    Letzter Beitrag: 19.10.07, 12:33
  2. Thread Problem
    Von yan1 im Forum .NET Windows Forms
    Antworten: 5
    Letzter Beitrag: 01.08.06, 17:42
  3. Thread Problem
    Von fh_study im Forum C/C++
    Antworten: 2
    Letzter Beitrag: 21.02.05, 15:05
  4. ein Thread-problem
    Von vaporizer im Forum Java
    Antworten: 4
    Letzter Beitrag: 17.08.04, 12:02
  5. Antworten: 19
    Letzter Beitrag: 12.07.02, 11:13