From b39aab214feecac6894777ca3475f7bb043f746e Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Sun, 7 Jan 2001 09:03:09 +0000 Subject: [PATCH] Increase BeOS event port capacity and avoid sending messages to event port if capacity is exceeded. Thanks to Makoto Hamanaka for the patch. Bug #63646. r=danm --- widget/src/beos/nsToolkit.cpp | 11 ++++++++++- xpcom/threads/plevent.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/widget/src/beos/nsToolkit.cpp b/widget/src/beos/nsToolkit.cpp index c0fa888cffe..9abd876a9e2 100644 --- a/widget/src/beos/nsToolkit.cpp +++ b/widget/src/beos/nsToolkit.cpp @@ -276,7 +276,16 @@ void nsToolkit::CallMethodAsync(MethodInfo *info) id.data = info; id.sync = false; - write_port_etc(eventport, WM_CALLMETHOD, &id, sizeof(id), B_TIMEOUT, 0); + + // Check message count to not exceed the port's capacity. + // There seems to be a BeOS bug that allows more + // messages on a port than its capacity. + port_info portinfo; + if (get_port_info(eventport, &portinfo) != B_OK) + return; + + if (port_count(eventport) < portinfo.capacity - 20) + write_port_etc(eventport, WM_CALLMETHOD, &id, sizeof(id), B_TIMEOUT, 0); } //------------------------------------------------------------------------- diff --git a/xpcom/threads/plevent.c b/xpcom/threads/plevent.c index 366fb727309..2406472c51f 100644 --- a/xpcom/threads/plevent.c +++ b/xpcom/threads/plevent.c @@ -767,7 +767,7 @@ failed: { /* create port */ - self->eventport = create_port(100, portname); + self->eventport = create_port(500, portname); /* We don't use the sem, but it has to be there */