summaryrefslogtreecommitdiffstats
path: root/Python/thread_solaris.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-10-08 14:17:53 (GMT)
committerGuido van Rossum <guido@python.org>1996-10-08 14:17:53 (GMT)
commitcf1474b73ad3e4085af220f3845b75b201974d38 (patch)
tree3f0376625f60a95747ce8e83307a3b15cf077f89 /Python/thread_solaris.h
parent5b1d9bad3266b90d7d37b7f2543d22887c2623c9 (diff)
downloadcpython-cf1474b73ad3e4085af220f3845b75b201974d38.zip
cpython-cf1474b73ad3e4085af220f3845b75b201974d38.tar.gz
cpython-cf1474b73ad3e4085af220f3845b75b201974d38.tar.bz2
Sjoerd's thread changes (including down_sema typo fix).
Note: waitflag not supported on NT.
Diffstat (limited to 'Python/thread_solaris.h')
-rw-r--r--Python/thread_solaris.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/Python/thread_solaris.h b/Python/thread_solaris.h
index f7fd056..871affa 100644
--- a/Python/thread_solaris.h
+++ b/Python/thread_solaris.h
@@ -25,6 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <errno.h>
#include </usr/include/thread.h>
#undef _POSIX_THREADS
@@ -211,12 +212,25 @@ void free_sema _P1(sema, type_sema sema)
free((void *) sema);
}
-void down_sema _P1(sema, type_sema sema)
+int down_sema _P2(sema, type_sema sema, waitflag, int waitflag)
{
+ int success;
+
dprintf(("down_sema(%lx) called\n", (long) sema));
- if (sema_wait((sema_t *) sema))
- perror("sema_wait");
- dprintf(("down_sema(%lx) return\n", (long) sema));
+ if (waitflag)
+ success = sema_wait((sema_t *) sema);
+ else
+ success = sema_trywait((sema_t *) sema);
+ if (success < 0) {
+ if (errno == EBUSY)
+ success = 0;
+ else
+ perror("sema_wait");
+ }
+ else
+ success = !success;
+ dprintf(("down_sema(%lx) return %d\n", (long) sema, success));
+ return success;
}
void up_sema _P1(sema, type_sema sema)