Hi,
I guess I should have spend a night before I posted the server based
sema code yesterday.
There was a questionable design decision in, which turned out to be a
bug not a feature. I happened to thing it would be useful to have a
semaphore destroyed when the creating thread disconnects, but this is a
really bad idea in multithreaded env's. So I removed it.
Instead I added a sema_get which yield the current value. Also I added
sema_[pv]n, which takes a positive integer as the second value and
plays the role of n p/v's at once.
sema_pn? will now allways return the old value of the sema. If it
returns zero you failed to get the sema, maybe due to a signal. I'm not
sure wether it would be better to add a loop around the msg_send in
the semalib.c.
As a side note: my weak english lead to a pun in the code.
BTW: it shouldn't be too hard to mount the server anywhere (but don't
open it at the moment :-() and write a small program which calls the
sema functions on the port of a specified file. Then you have sema's
ready in shell scripts.
Sorry for the inconvenience. Here is the corrected code:
begin 644 sema.tz
M'XL(`!E-$2\``^T;_4_;R+*_XK]BFKZV3FI"$D*12-,31],>>@4JH+V3[ITB
M8V\2/QRO6=L)N8K__<WLA^T$*.C=`7I/7G&-O9Z=G9F=S]V]X\'NAX/!LP=M
M[5;K;;<+SP"@N]F1O]#>5K_TN+79!=C:;G4[G<VW[2WLVM[NMIY!ZV')4BU+
M4E<`//OW_"XX)I+'(.AQV]K:FEJ%]<9ZRBY3_+<TF0`/ZY<)$%WCE,79^!
M?9:ED(1\7H=@&H=LRJ+430,>`1]!PJ9N/.&")4W+VD\!I47#468S)F`^";P)
MQ(+/`A_[TPE;'B#GT[`^9TGT.C70$CA+,C>$41"J<6G@-4&-F?`L].&,6:[O
M,Q\2/DV#*4YA[^/`(#K'?]T4W#!<F=2,G+@SAG1F47"1,8MFB-PI\AKS)`G.
M0C4]%SX2AEQZ@BF.:9(ZN)$/KF*'1GH\2E$F%KU[F1#X##,WS%B]"3^C[/:1
M-^),SDE`A`52CMU$;`)G"XCX'.7Q4?!I3G#*DK3IP8)GX+D1=C&8\#F-0R&K
M@<3JN(EB9##E24KKPP72XD/L"GQ-'"T')'F!C\B&CXNZ4`PQN5!:,A8202_#
MB,T=H"6G(1R)$3!%6T$*4Q!LQ)`]CT&0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*
MIHZ2`4;@8+2P,?+AE##XY_[GSZO]G:+?*@1V'H2AB=D*XZ9\SN5;Q:JJ5:UJ
J5:M:U:I6M:I5K6I5JUK5JE:UJE6M:E6K6M6J5K6J/5W[#\^/2F(`4```
`
end
-----------------------------------------------------------------------------
Joerg Wittenberger | email: joerg.wittenberger@inf.tu-dresden.de
Rietzstr. 32b |
01139 Dresden |
Germany | PGP: D4 B2 DA AE C3 02 50 9C 45 3E AD 99 C1 1A 8E F8
WWW: <a href=http://www.inf.tu-dresden.de:~jw6/top.html> (click here) </a>
Received on Mon Jan 9 07:05:09 1995
This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:11 PDT