| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Mutex semaphores |
Hallo Phil!
Antwort auf eine Message von Phil Crown an Mario Semo:
PC> But, is the overhead of creating the mutex semaphore trivial? My code
PC> has two threads calling this semaphore VERY often.
the difference are just a few machine statement . I'm not creating the
sema4 multiple times (which wouldn't work), i'm just creating a sema4
Request object whenever i need it. and i just create it inline. so the only
difference is a initialization of a local variable.
PC> Also, say one thread has created the sem and is pre-empted before
PC> deleteing it, what happens when the second thread tries to create a
PC> sem with the same name? Error code or exception or blocks until the
PC> first thread deletes the sem?
again: i do:
LCtMutexSema4 mySem("sema"); // eq. global
and the code to be protected is doing:
{
LCtMutexSema4::Request x(mySema);
// store mySema handle to x and perform a mySema.request();
code to be protected.
}
// end of block automatically (C++!!) destroys all local objects
(objects on the stack)
// so '~x' is called and this performs a mySem.release();
Servus, Mario!
--- FleetStreet 1.18 PR#2
* Origin: LC/32 Development Team, KirchnerSoft, Vienna, Austria (2:310/14.11)SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1 @PATH: 310/14 1 24/999 888 396/1 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.