Sunday, December 30, 2018

The universal interface and multi-threading

Easily done because every subsystem has a single universal interface.  here is xchars mutex method. As soon as it it ready to execute, it protects state.  

// Command arg1 rg2 ... 
int Entry(int *argc, void *args[]) {
int status;
PSym enter;
pthread_mutex_t xchars_mutex;
if(!strcmp(args[*argc],"Init")) return(Init(argc,args));
printf("%s\n",(char *) args[*argc]);
enter = check_arg(args[*argc],entry_t,&status);
if(!status)  return(0);
pthread_mutex_lock(&xchars_mutex);
enter->def.entry(argc,args);
pthread_mutex_unlock(&xchars_mutex);
return(1);
}

Currently testing NewWin and DelWin at high speed, make sure no memory leak.  Xchars will make as many windows as you call, makes no effort to coordinate them except that they are attached to a connection.

No comments: