/* context_cojava - implementation of context switching for java coroutines */
-/* Copyright 2012. The SimGrid Team.
+/* Copyright (c) 2012-2013. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_DEBUG("Switching to %p",my_current_context);
smx_ctx_cojava_t java_context = (smx_ctx_cojava_t)(next_context);
if (!java_context->jprocess) {
- (*(java_context->super.code))(java_context->super.argc, java_context->super.argv);
+ java_context->super.code(java_context->super.argc, java_context->super.argv);
smx_ctx_cojava_create_coroutine(java_context);
}
else if (!java_context->bound) {
smx_ctx_cojava_t java_context = (smx_ctx_cojava_t)(new_context);
if (!java_context->jprocess) {
- (*(java_context->super.code))(java_context->super.argc, java_context->super.argv);
+ java_context->super.code(java_context->super.argc, java_context->super.argv);
smx_ctx_cojava_create_coroutine(java_context);
java_context->bound = 1;
}
{
cojava_processes = SIMIX_process_get_runnable();
smx_process_t process;
- if (xbt_dynar_length(cojava_processes) > 0) {
+ if (!xbt_dynar_is_empty(cojava_processes)) {
process = xbt_dynar_get_as(cojava_processes, 0, smx_process_t);
cojava_process_index = 1;
/* Execute the first process */
FILE *conf= fopen("/proc/sys/vm/max_map_count","r");
if (conf) {
int limit=-1;
- fscanf(conf,"%d",&limit);
+ if(fscanf(conf,"%d",&limit) != 1)
+ xbt_die("Error while creating a new coroutine. Parse error.");
fclose(conf);
if (limit!=-1 && SIMIX_process_count() > (limit - 100) /2)
xbt_die("Error while creating a new coroutine. "