| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Semaphores (16 & 32) |
DM> First problem:
DM> I'm trying to block Sq386p.exe which uses
DM> \SEM\SQUISH\DEFAULT, however the Semaphores included
DM> in the Warp toolkit want me to use \SEM32\ to start.
DM> Can I just use \SEM\ anyway?
Not with the 32bit calls. I wrote that piece of squish code, when
everything was 16bit, and I guess Scott left it that way to be backwards
compatible.
[Tip: little known squish feature: the name of the sem can be
specified with the BBSSEM env var, if you want to have
two (or more) copies of squish running that do not share
any files]
Here is the code...You're best bet is to plop it into a 16bit dll and call
it from your 32bit code (when I first created it, it WAS a dll I think,
but it got integrated into squishp at some point). Look for something
called something like smserial.dll.
If you try to compile it for 32bits, you might have to change the sem
calls to "Dos16CreateSem", etc, and prototype them yourself.
static HSYSSEM hssm;
static void cdecl _loadds clearsem(void)
{
DosSemClear(hssm);
DosCloseSem(hssm);
}
void serialize(char *SemName)
{
USHORT rc;
if(!SemName)
SemName = "/sem/squish/default";
rc = DosCreateSem(CSEM_PUBLIC, &hssm, SemName);
if(rc == ERROR_ALREADY_EXISTS){
rc = DosOpenSem(&hssm, SemName);
if(!rc){
printf("Waiting for %s to clear...\n", SemName);
rc = DosSemRequest(hssm, -1L);
if(rc == ERROR_SEM_OWNER_DIED)
rc = 0;
}
else
printf("OS/2 error %04x opening semaphore '%s'\n",
rc, SemName);
}
else if(!rc){
DosSemRequest(hssm, -1L);
}
else
printf("OS/2 error %04x creating semaphore '%s'\n", rc, SemName);
if(rc)
exit(1);
else
onexit((onexit_t)clearsem);
}
--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955 SEEN-BY: 712/407 515 517 628 713/888 800/1 @PATH: 259/414 400 99 250/99 3615/50 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™.