mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
gst/tcp/gstfdset.c: Realloc test fdset in the lock and right before starting the poll call. Bump the limit to 4096.
Original commit message from CVS: * gst/tcp/gstfdset.c: (ensure_size), (gst_fdset_wait): Realloc test fdset in the lock and right before starting the poll call. Bump the limit to 4096.
This commit is contained in:
parent
a609521ec6
commit
d5c88bc058
1 changed files with 8 additions and 3 deletions
|
@ -20,7 +20,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MIN_POLLFDS 64
|
#define MIN_POLLFDS 4096
|
||||||
#define INIT_POLLFDS MIN_POLLFDS
|
#define INIT_POLLFDS MIN_POLLFDS
|
||||||
|
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
|
@ -55,10 +55,12 @@ struct _GstFDSet
|
||||||
|
|
||||||
/* for poll */
|
/* for poll */
|
||||||
struct pollfd *testpollfds;
|
struct pollfd *testpollfds;
|
||||||
|
gint testsize;
|
||||||
|
|
||||||
struct pollfd *pollfds;
|
struct pollfd *pollfds;
|
||||||
gint last_pollfds;
|
|
||||||
gint size;
|
gint size;
|
||||||
gint free;
|
gint free;
|
||||||
|
gint last_pollfds;
|
||||||
GMutex *poll_lock;
|
GMutex *poll_lock;
|
||||||
|
|
||||||
/* for select */
|
/* for select */
|
||||||
|
@ -87,7 +89,6 @@ ensure_size (GstFDSet * set, gint len)
|
||||||
need = MAX (need, MIN_POLLFDS * sizeof (struct pollfd));
|
need = MAX (need, MIN_POLLFDS * sizeof (struct pollfd));
|
||||||
|
|
||||||
set->pollfds = g_realloc (set->pollfds, need);
|
set->pollfds = g_realloc (set->pollfds, need);
|
||||||
set->testpollfds = g_realloc (set->testpollfds, need);
|
|
||||||
|
|
||||||
set->size = need;
|
set->size = need;
|
||||||
}
|
}
|
||||||
|
@ -395,6 +396,10 @@ gst_fdset_wait (GstFDSet * set, int timeout)
|
||||||
gint last_pollfds;
|
gint last_pollfds;
|
||||||
|
|
||||||
g_mutex_lock (set->poll_lock);
|
g_mutex_lock (set->poll_lock);
|
||||||
|
if (set->testsize != set->size) {
|
||||||
|
set->testpollfds = g_realloc (set->testpollfds, set->size);
|
||||||
|
set->testsize = set->size;
|
||||||
|
}
|
||||||
last_pollfds = set->last_pollfds;
|
last_pollfds = set->last_pollfds;
|
||||||
memcpy (set->testpollfds, set->pollfds,
|
memcpy (set->testpollfds, set->pollfds,
|
||||||
sizeof (struct pollfd) * last_pollfds);
|
sizeof (struct pollfd) * last_pollfds);
|
||||||
|
|
Loading…
Reference in a new issue