On Fri, 31 Oct 2008, Szak�ts Viktor wrote: Hi Viktor,
> Then we should probably also have hb_criticalsection*() > functions instead of hb_mutex*() to not use two different > terminologies in different parts of Harbour. I do not agree. The internal synchronization mechanism used on low level is our own choice which should be tuned to best .prg code performance and protection. We can internally use different synchronization mechanism for functions and .prg mutexes on some platforms. It's not user problem to guess which ones. > Critical is a programming terminology from a lower level > perspective (I wouldn't want to elaborate on the possible > roots of the term, but it looks to originate from low level > OS programming), and there, critical may indeed mean critical, > but in Harbour .prg level this looks like a way too harsh > word and seems to be somewhat disconnected from the world > of such a high level programming language. "critical section" > seems to mean a subset of the more generic term "mutex". > No wonder high level languages (C#/Java/XBase++) don't use > the "critical section" terminology. They do. They discribe code protected by synchronization mechanism as CRITICAL SECTION. > If you read the wikipedia article to the end, it turns out > that POSIX calls "critical sections" simply "mutex", and In POSIX documentation you can find that MUTEXes are synchronization mechanism to guard CRITICAL SECTION of code, f.e. copy and past from simple search: The prioceiling attribute defines the priority ceiling of initialized mutexes, which is the minimum priority level at which the critical sec- tion guarded by the mutex is executed. In order to avoid priority > the only cited example where it's called "critical sections" > is in Windows itself, which is an operating system, where > such name can even have a real meaning on that low level. Not true see above. > They've probably named it that way because they've used > up "mutex" for the inter-process variation. (this is in > sync with C#, but there they've named intra-process, I do not think so. When CRITICAL_SECTION was introduced to Windows MUTEX was not well know term but CRITICAL SECTION was. Even today many people prefer to use SEMAPHORE instead of MUTEX. > aka 'critical sections' ones simply 'locks', probably for > similar reason I'm trying to show). > Also, "critical" by itself doesn't mean anything above, it's > always used in conjunction with "section", so the term or CODE or INTERRUPT or EXCEPTION or HANDLER or OPERATION or SERVICE ... Some of them are used in very similar context to CRITICAL FUNCTION | PROCEDURE. > is "critical section". If we say "critical function/procedure", > or just "critical" as a single word, to me it looks something > completely different. CRITICAL SECTION in informatics terms means peace of code which should not be interrupted by other code/events. In MT programming it was adopted as peace of code which can be entered only by one thread. But in fact it's not common definition. This term is also used to define peace of code which can be executed only when all other threads or processes are stooped. It's also used to define peace of code which cannot be interrupted by any exceptions or OS scheduler. > Java uses the keyword "mutexed" which IMO tells it best > that a given object is automatically protected by a mutex. I didn't know about it. Can you show the whole syntax? best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour