mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
tpws: decrease process VSZ by limiting thread stack size
This commit is contained in:
parent
72762694df
commit
a760745452
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -179,14 +179,24 @@ bool resolver_init(int threads, int fd_signal_pipe)
|
|||||||
action.sa_handler = sigbreak;
|
action.sa_handler = sigbreak;
|
||||||
sigaction(SIG_BREAK, &action, NULL);
|
sigaction(SIG_BREAK, &action, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
pthread_attr_t attr;
|
||||||
|
if (pthread_attr_init(&attr)) goto ex1;
|
||||||
|
// set minimum thread stack size
|
||||||
|
if (pthread_attr_setstacksize(&attr,20480))
|
||||||
|
{
|
||||||
|
pthread_attr_destroy(&attr);
|
||||||
|
goto ex1;
|
||||||
|
}
|
||||||
for(t=0, resolver.threads=threads ; t<threads ; t++)
|
for(t=0, resolver.threads=threads ; t<threads ; t++)
|
||||||
{
|
{
|
||||||
if (pthread_create(resolver.thread + t, NULL, resolver_thread, NULL))
|
if (pthread_create(resolver.thread + t, &attr, resolver_thread, NULL))
|
||||||
{
|
{
|
||||||
resolver.threads=t;
|
resolver.threads=t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pthread_attr_destroy(&attr);
|
||||||
if (!resolver.threads)
|
if (!resolver.threads)
|
||||||
{
|
{
|
||||||
// could not start any threads
|
// could not start any threads
|
||||||
|
Loading…
Reference in New Issue
Block a user