c# - CPU is 100% at multithreading -
first i've read posts here regarding issue , manged progress bit. seems need :)
i have program several threads, (not always) cpu usage of program increasing 100% , never reduced until shut down program.
as read in other similar posts, ran app using visual studio (2012 - ultimate). paused app, , open threads window. there pauses threads until i've found 4 threads stuck app. refer same line of code (a call constructor). checked constructor inside , outside , couldn't find loop cause it. more careful i've added break point every line of code , resume app. none of them have been triggered.
this line of code:
public static void generatedefacementsensors(icrawlermanager cm) { m_sensorsmap = new dictionary<defacementsensortype, defacementsensor>(); // create instance of sensors // new defacement sensor, don't forget add appropriate line here // m_sensorsmap.add(defacementsensortype.[type], new [type]sensor()) try { if (m_sensorsmap.count <= 0) { m_sensorsmap.add(defacementsensortype.backgroundsensor, new backgroundsensor()); m_sensorsmap.add(defacementsensortype.taglinessensor, new taglinessensor(cm.database)); m_sensorsmap.add(defacementsensortype.singleimagesensor, new singleimagesensor()); } } catch (exception) { console.writeline("there problem initializing defacement sensors"); } }
the second "m_sensorsmap.add" marked green arrow, understand it, means it's still waiting first line finish.
by way, m_sensorsmap.count value 3.
how can find problem? loop? or maybe deadlock (not make sense because shouldn't 100% cpu, right?) it's pointless upload code because huge project. need more general how debug? else loop?
because it's bug returns every while , i'm not closing app until found problem :)
thanks in advance!!
edit: constructors:
public taglinessensor(idatabase db) { m_db = db; }
i couldn't found problem i've changed design on order not call constructors anymore.
thanks guys tried help.
shaul
Comments
Post a Comment