[VSDK] Semaphore freeze after a crash

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Jan 6 00:21:31 CST 2004


on 1/5/04 9:45 PM, Totte Alm at totte at code66.se wrote:

> Eric, Ruslan!!
> 
> I've tried to make Ruslan fix this bug for 6 months!!

> Its because of the fact that deep inside VSDK, there is a MUTEX that is
> created with the WRONG parameter, probably proted Windows code, as  Windows
> Mutexes are REENTRANT by default unless you explicit specify POSIX  Mode, but
> on UNIX Mutexes are NOT REENTRANT, hence the bug doesnt show up in the VSDK
> for Win32.
> 
> If you have code to preproduce it, please send it to Ruslan as he  "denies the
> existance of that mutex"! I KNOW its deep down in the FBL stuff, and its
> becuase the mutex stuff  is classes them self, and its hard to try to folow
> WHAT is really  compiled when we only have parts of it and not KNOW what
> really inside the VSDK  Framework and really gets called.
> 
> Sorry for the rough language, but I've really really really tried to
> make Ruslan fixc this one, but he cant find it...

Correct.

> #0    0x90017048 in semaphore_wait_signal_trap
> #1    0x90002300 in pthread_mutex_lock
> #2    0xb0041028 in FBL_IndexerTask::Run()

1) You both use VSDK.framework made with xCode.

2) This framework is built with FBL_SyncObjectsMac.cpp file.

3) you can see sources of all my Thread classes in the VSDK_MAC archive.

4) you can see that in file FBL_SyncObjectsMac.cpp I do not use pthreads
    directly. 
   
    I call CARBON thread API as ::YieldToAnyThread();


5) in the crash log we see call to pthread_mutex_lock
    
    I assume Apple call it in background.

This is why, Totte, I cannot add that parameter
to mutex to make it REENTRANT.
This is NOT MY mutex.


6) Totte, I did offer you one way to solve this:
    
-- framework include already compiled file FBL_SyncObjectsMac.cpp

-- but at least in Visual C++, it is possible to include cpp file again into
project, even it is already compiled into some DLL. May be xCode also allow
such trick.

So you need to try include FBL_SyncObjectsMac.cpp file into YOUR project.
Visual in this case simply say:
    2 definitions of function found. Second is ignored.
 

IF this trick works you can
A) DEBUG when and how my functions are called.
B) may be you can simply comment out call ::YieldToAnyThread();
    for YOUR project and may be this will make a trick.



7) I really do not want spend time on this now, if above workaround will
work. In 2.0 we will have pthreads for OS X Valentina engine.

And CARBON/CLASSIC versions of engine (if they will exists) will be simply
single threads. 
 

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list