! -x[[-] ] parsing needed but here not related to OpenMP etc - it is just a local option */
| 143 | |
| 144 | /*! -x[[-]<ncores>] parsing needed but here not related to OpenMP etc - it is just a local option */ |
| 145 | GMT_LOCAL int batch_parse_x_option (struct GMT_CTRL *GMT, struct BATCH_CTRL *Ctrl, char *arg) { |
| 146 | if (!arg) return (GMT_PARSE_ERROR); /* -x requires a non-NULL argument */ |
| 147 | if (arg[0]) |
| 148 | Ctrl->x.n_threads = atoi (arg); |
| 149 | |
| 150 | if (Ctrl->x.n_threads == 0) /* Not having any of that. At least one */ |
| 151 | Ctrl->x.n_threads = 1; |
| 152 | else if (Ctrl->x.n_threads < 0) /* Meant to reduce the number of threads */ |
| 153 | Ctrl->x.n_threads = MAX(GMT->parent->n_cores + Ctrl->x.n_threads, 1); /* Max-n but at least one */ |
| 154 | return (GMT_NOERROR); |
| 155 | } |
| 156 | |
| 157 | GMT_LOCAL void batch_close_files (struct BATCH_CTRL *Ctrl) { |
| 158 | /* Close all files when an error forces us to quit */ |