mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-11 17:29:16 +05: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;
|
||||
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++)
|
||||
{
|
||||
if (pthread_create(resolver.thread + t, NULL, resolver_thread, NULL))
|
||||
if (pthread_create(resolver.thread + t, &attr, resolver_thread, NULL))
|
||||
{
|
||||
resolver.threads=t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pthread_attr_destroy(&attr);
|
||||
if (!resolver.threads)
|
||||
{
|
||||
// could not start any threads
|
||||
|
Loading…
Reference in New Issue
Block a user