Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Managing error event within critical section???
Message
From
24/01/2007 11:48:39
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01188583
Message ID:
01188775
Views:
30
>>a) You rely on Destroy being executed after you canceled execution.
>
>I'm already so dependent on the Destroy firing (and thus tested it pretty thoroughly) that I think this is a safe assumption. The only time that Destroy doesn't fire is if the Init event fails.
>
>>b) I've no idea where VFP keeps the count for critical sections.
>
>Indeed, that is the rub. The more I think about it, the more it seems that SYS(2336,3) must apply to the CS reference count for _only_ the thread that invokes the SYS function. More than one thread cannot simultaneously control the underlying CS object. So my guess (my hope) is that the VFP library maintains a TLS reference count, and that if you call SYS(2336,3) from within a thread whose current reference count is zero, then the VFP library will do nothing. Surely they wouldn't leave that kind of worrying to a klutz like me... i.e., they would protect me from myself, no? The API documentation is clear that a thread should not attempt a LeaveCriticalSection without currently "owning" the CS object.

I've been waiting (for years) for questions about "critical sections" to come up here.

In my opinion the "documentation" on the subject has been so poor from the get-go that it's really impossible to use the feature.
Sure, one could make observations to (try to) draw conclusions. But then it was observation that had most of the world believing that the sun revolved around the earth. In other words, observations prove nothing except for the EXACT case observed. And in the case of critical sections we have no idea just what may affect any of it.
Previous
Reply
Map
View

Click here to load this message in the networking platform