What is the difference between:
thread_envs[i] = soap_copy(&env);
and
thread_envs[i] = soap_new();
Sould we use one of them or both?
What is the difference between:
thread_envs[i] = soap_copy(&env);
and
thread_envs[i] = soap_new();
Sould we use one of them or both?
From the documentation:
struct soap *soap_new()
Allocates, initializes, and returns a pointer to a runtime environment
struct soap *soap_copy(struct soap *soap)
Allocates a new runtime environment and copies contents of the environment such that the new environment does not share any data with the original environment
The answer really depends on your intention: do you want a new, blank environment for each thread (use soap_new()
) or a separate copy of the existing environment for each thread (use soap_copy()
). The process of copying the environment probably has some additional overhead, so all other things being equal, use soap_new()
.