Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion man/mono.1
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ the global assembly cache is always trusted.
.TP
\fB--server\fR
Configures the virtual machine to be better suited for server
operations (currently, a no-op).
operations (currently, allows a heavier threadpool initialization).
.TP
\fB--verify-all\fR
Verifies mscorlib and assemblies in the global
Expand Down
14 changes: 14 additions & 0 deletions mono/metadata/mono-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,3 +790,17 @@ mono_config_parse_assembly_bindings (const char *filename, int amajor, int amino
mono_config_parse_file_with_context (&state, filename);
}

static gboolean mono_server_mode = FALSE;

void
mono_config_set_server_mode (gboolean server_mode)
{
mono_server_mode = server_mode;
}

gboolean
mono_config_is_server_mode (void)
{
return mono_server_mode;
}

3 changes: 3 additions & 0 deletions mono/metadata/mono-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ void mono_config_parse_memory (const char *buffer);

const char* mono_config_string_for_assembly_file (const char *filename);

void mono_config_set_server_mode (gboolean server_mode);
gboolean mono_config_is_server_mode (void);

MONO_END_DECLS

#endif /* __MONO_METADATA_CONFIG_H__ */
Expand Down
7 changes: 5 additions & 2 deletions mono/metadata/threadpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <mono/metadata/threadpool-internals.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/environment.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/mono-mlist.h>
#include <mono/metadata/mono-perfcounters.h>
#include <mono/metadata/socket-io.h>
Expand Down Expand Up @@ -1064,8 +1065,10 @@ threadpool_append_jobs (ThreadPool *tp, MonoObject **jobs, gint njobs)
}
/* Create on demand up to min_threads to avoid startup penalty for apps that don't use
* the threadpool that much
* mono_thread_create_internal (mono_get_root_domain (), threadpool_start_idle_threads, tp, TRUE, FALSE, SMALL_STACK);
*/
*/
if (mono_config_is_server_mode ()) {
mono_thread_create_internal (mono_get_root_domain (), threadpool_start_idle_threads, tp, TRUE, FALSE, SMALL_STACK);
}
}

for (i = 0; i < njobs; i++) {
Expand Down
5 changes: 3 additions & 2 deletions mono/mini/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1715,9 +1715,10 @@ mono_main (int argc, char* argv[])
}
} else if (strcmp (argv [i], "--desktop") == 0) {
mono_gc_set_desktop_mode ();
/* Put desktop-specific optimizations here */
/* Put more desktop-specific optimizations here */
} else if (strcmp (argv [i], "--server") == 0){
/* Put server-specific optimizations here */
mono_config_set_server_mode (TRUE);
/* Put more server-specific optimizations here */
} else if (strcmp (argv [i], "--inside-mdb") == 0) {
action = DO_DEBUGGER;
} else if (strncmp (argv [i], "--wapi=", 7) == 0) {
Expand Down