d'Doc
Alabang, Muntinlupa City, Philippines
Beer-loving Gunner extraordinaire, perennial vocalist, guitarist, dog person, and wet kisser in one neat li'l package.
>> VIEW MY COMPLETE PROFILE
>> Home
Subscribe to Posts [Atom]
Links
Previous Posts
Archives

|
|
Macros are Evil, a Multi-Threaded Scenario |
| |
The daemon I mentioned in my preceding post did fail some debug assertions which I found out came from the U++ MAP containers. Now this confirms my suspicion that there was a race condition in my app which puts the container in a "volatile" state. Digging though my code I found out that this code:
#ifdef GUI_POST_CALLBACK #define MUTEX_LOCK(mutex) Mutex::Lock __(mutex) #else #define MUTEX_LOCK(...) ((void)0) #endif
should have been:
#ifdef GUI_POST_CALLBACK #define MUTEX_LOCK(...) ((void)0) #else #define MUTEX_LOCK(mutex) Mutex::Lock __(mutex) #endif
Let me explain. Posted callbacks (using U++ PostCallback() in GUI mode) are called with mutex locking automatically done by the U++ framework. Since a daemon is not a GUI app, GUI_POST_CALLBACK is not defined, which leaves me to create my own locking. In the incorrect code above the ifdef guard was reversed thus calling MUTEX_LOCK(mutex_) had no effect in my code, leaving the daemon code vulnerable to non-preemptive data sharing! Reversing it solved the problem. No more crashing!
Whew, definitely NOT python + twisted! :D
Subscribe to Posts [Atom] |
| |
| |
|
|
| |
Using SetAssertFailedHook() in U++ |
| |
A few months back, I started using Ultimate++ which is IMHO, a very elegant development framework in C++. One interesting facet of U++ (and one which deserves a more comprehensive treatment treatment than a side note) is its aggressive use of C++, which deviates from the standard. U++ containers, unlike STL ones do not require their contained objects to have a deep copy constructor. That being said, U++ or NTL containers can be magnitudes faster in performance than their STL counterparts by virtue of not having to copy an element every time you insert or append one. The caveat is you have to follow (a few) certain rules, which someone coming from an STL background can forget from time to time. Luckily for noobs like me though, the debugging facilities of U++ are excellent, with the downside of being poorly documented! I am currently writing a daemon in U++ and I am constantly wondering why my app (built in debug mode) gets terminated from time to time with only a "Received Terminate Signal" in my logs (for some reasons I am using my own logging facility and not syslog). Digging down deeper into my code, I found out that the daemon terminates with this message when it receives either a SIGABRT or a SIGTERM signal. Now the only reason I can suspect is that a debug assertion is failing and the abort(3) funtion of stdlib is sending the SIGABRT. So how to catch that assertion? Although the forum members of U++ are very friendly and comes to your rescue ASAP, my philosophy in development is if you don't need to ask, don't, and this is how I got by all this time in Symbian and other forums---by just using the search button or its command line brother, grep. Anyway, I wasn't in the mood to dig up forum posts and thought it's easier to grep through U++ code (yeah, you get the U++ source code too, swell huh?). The result? SetAssertFailedHook(). void MyAssertFailedHook_(const char* msg) { // Log msg here } // ... SetAssertFailedHook(MyAssertFailedHook_); That's it. Problem licked! Oh, btw, the daemon is called sentinel. :D
Subscribe to Posts [Atom] |
| |
| |
|
|
| |
If there was a thing on the net filled with more bullshit... |
| |
... than this: http://forums.gov.ph/thread.asp?rootID=127876&catID=25 please, please show me! The Philippines is a Spanish creation, bah! I quote the beginning of the forum post: "The Philippines is a Spanish creation. Without Spain, there would have been no Philippines to talk about. If we weren't conquered by Spain, we would have ended up as either separate warring kingdoms/tribes (tribu de los tagalos, tribu de las visayas, tribu de los ilocanos, tribu de los mangyanes, etc.) or a Portuguese/Indonesian territory..." And it gets worse from that point on. No, I will not sully my humble blog by quoting more. Jose Mario "Pepe" Alas, if you want to kneel before those Spanish bastards who raped this lands for more than three hundred years and lick their smelly asses again, be my fucking guest! But keep your dirty paws off the Internet if you don't have anything worthwhile to say! You're almost literally saying that the pre-hispanic Philippines without any outside interference could not establish itself as a state, forgetting only too well that even your European colonizers started off as small conquering tribes before they banded up to become a big conquering monstrosity that used the bible and the sword to subjugate what was to become Pilipinas. The Spanish brought the religion of my forefathers to this country and if my ancestors up to my mother and father found solace in the Roman Catholic brand of Christianity then well and good but make no mistake that the only reason and purpose that the name of Christ was cast into this mess is for subjugation and control! Spain was not interested in what the Indios, as a people, could offer, they were only interested in the natural resources these lands could yield. Why else would they not make us a proper province after three hundred long years? Why else, would they hold a religion that teaches love and goodwill to all men as a sword over our poor ancestors' heads? "Pay your dues or the fires of hell will consume you...", my father recalls very well why his grandfather and relatives was forced to move from Camiguin to the forests of Zamboanga del Sur, to escape the wrath of Spanish friars whose taxes they could not afford to pay anymore with what remained of their dignity. Now tell me about this creation bullshit again?
Subscribe to Posts [Atom] |
| |
| |
|
|
| |
"makipagclose ka kay mark doc..." |
| |
"panu b maging moderator ng uzzap" A topic I happened upon here: http://www.symbianize.com/showthread.php?t=102915Ahahahahaha! Some posts (in the url above) that really made my day: "Punta ka smart tapos bayaran mo yung mods nila dun. (kung papayag). Mahirap kasi yan otor.""w0w moderator ng uzzap.. maging isa ka sa pinakamagaling na it dito sa pinas tapos magapply ka sa smart makipagclose ka kay mark documento ata yun tapos yun baka gawin karin nyang moderator.. Goodluck.. haha,."Damn! I gotta limit my visibility.
Subscribe to Posts [Atom] |
| |
| |
|
|
| |
Trivia and Other Games Top Scorers - Uzzap |
| |
Top 25 score(r)s for the trivia game in Sietch Tabr on Oct. 9-Oct. 17, 2009. nautica 1200 rippogi 1020 ~genkin~ 747 Chronus 568 shaira:e09 557 hideandseek7 543 (+)|caduceuz 500 pukinginamo 434 redjuan 239 TRT>,ANGEL, 1932 235 slyvixen 224 C1N])3R3||A 215 nanref 214 darkflame24 200 PriTi ~,^ 198 Aki 191 frozenflame 172 obraPUZA:o? 163 aleakim05 156 slaynfx 154 KYUt \:>/, kenjitots 140 jefferson 129 reycop 91 r0ckyken 87 aphrogirl 86 Top 15 score(r)s for the trivia game in Tambayan 27 on Oct. 13-Oct. 15, 2009. vew 225 alva 184 01 117 yUnA 100 maeden 79 shirosaki 79 RAH|*}\{imzo 67 [>;~ 63 w!nx 41 gx~`jhii`Sh 32 gavino ang 25 cielo 22 ellemo1224 15 jefferson 13 jaymeern 13 Till the next!
Subscribe to Posts [Atom] |
| |
| |
|
|
| |
|
|