Changeset 5312:27ec111dc8c5 in roaraudio for roard


Ignore:
Timestamp:
11/30/11 01:05:41 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support for seperate contextes for roardl/plugins. Currently incudes error state and a global per handle data segment. This does not work for statically linked librarys (yet). support for per-context notify core needs to be added/completed.

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/clients.c

    r5304 r5312  
    3838#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
    3939#ifdef ROAR_HAVE_H_ESD 
    40  {ROAR_PROTO_ESOUND, ROAR_SUBSYS_WAVEFORM, "EsounD emulation", NULL, emul_esd_check_client, NULL, NULL}, 
     40 {ROAR_PROTO_ESOUND, ROAR_SUBSYS_WAVEFORM, "EsounD emulation", NULL, NULL, emul_esd_check_client, NULL, NULL}, 
    4141#endif 
    4242#endif 
    4343#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    44  {ROAR_PROTO_RPLAY, ROAR_SUBSYS_WAVEFORM, "RPlay emulation", NULL, emul_rplay_check_client, NULL, NULL}, 
     44 {ROAR_PROTO_RPLAY, ROAR_SUBSYS_WAVEFORM, "RPlay emulation", NULL, NULL, emul_rplay_check_client, NULL, NULL}, 
    4545#endif 
    4646#ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER 
    47  {ROAR_PROTO_GOPHER, ROAR_SUBSYS_WAVEFORM, "The Internet Gopher Protocol", NULL, emul_gopher_check_client, NULL, emul_gopher_flushed_client}, 
    48 #endif 
    49  {-1, 0, NULL, NULL, NULL, NULL, NULL} 
     47 {ROAR_PROTO_GOPHER, ROAR_SUBSYS_WAVEFORM, "The Internet Gopher Protocol", NULL, NULL, emul_gopher_check_client, NULL, emul_gopher_flushed_client}, 
     48#endif 
     49 {-1, 0, NULL, NULL, NULL, NULL, NULL, NULL} 
    5050}; 
    5151 
     
    647647     if ( g_proto[i].proto == c->proto ) { 
    648648      roar_vio_open_fh_socket(&vio, clients_get_fh(id)); 
     649      if ( g_proto[i].lhandle != NULL ) 
     650       roar_dl_context_restore(g_proto[i].lhandle); 
    649651      rv = g_proto[i].check_client(id, &vio); 
     652      if ( g_proto[i].lhandle != NULL ) 
     653       roar_dl_context_store(g_proto[i].lhandle); 
    650654     } 
    651655    } 
     
    686690 
    687691 if ( p->flush_client != NULL ) { 
     692  if ( p->lhandle != NULL ) 
     693   roar_dl_context_restore(p->lhandle); 
    688694  return p->flush_client(id, &vio); 
     695  if ( p->lhandle != NULL ) 
     696   roar_dl_context_store(p->lhandle); 
    689697 } 
    690698 
     
    716724 if ( cs->outbuf == NULL ) { 
    717725  if ( p->flushed_client != NULL ) { 
     726   if ( p->lhandle != NULL ) 
     727    roar_dl_context_restore(p->lhandle); 
    718728   return p->flushed_client(id, &vio); 
     729   if ( p->lhandle != NULL ) 
     730    roar_dl_context_store(p->lhandle); 
    719731  } 
    720732 } 
     
    813825 
    814826// proto support 
    815 int clients_register_proto(struct roard_proto * proto) { 
     827int clients_register_proto(struct roard_proto * proto, struct roar_dl_lhandle * lhandle) { 
    816828 const size_t len = sizeof(g_proto)/sizeof(*g_proto); 
    817829 size_t i; 
     
    829841 
    830842 memcpy(&(g_proto[i]), proto, sizeof(*g_proto)); 
     843 
     844 g_proto[i].lhandle = lhandle; 
    831845 
    832846 return 0; 
  • roard/include/client.h

    r5301 r5312  
    7878 int subsystems; 
    7979 const char * description; 
     80 struct roar_dl_lhandle * lhandle; 
    8081 int (*new_client)(int client, struct roar_vio_calls * vio, struct roard_listen * lsock); 
    8182 int (*check_client)(int client, struct roar_vio_calls * vio); 
     
    116117 
    117118// proto support 
    118 int clients_register_proto  (struct roard_proto * proto); 
     119int clients_register_proto  (struct roard_proto * proto, struct roar_dl_lhandle * lhandle); 
    119120int clients_unregister_proto(int proto); 
    120121void print_protolist        (enum output_format format); 
  • roard/plugins.c

    r5275 r5312  
    5757 int i; 
    5858 
    59  if ( plugin->sched != NULL ) 
    60   if ( plugin->sched->free != NULL ) 
     59 if ( plugin->sched != NULL ) { 
     60  if ( plugin->sched->free != NULL ) { 
     61   roar_dl_context_restore(plugin->lhandle); 
    6162   plugin->sched->free(); 
     63   roar_dl_context_store(plugin->lhandle); 
     64  } 
     65 } 
    6266 
    6367 for (i = 0; i < MAX_PROTOS; i++) { 
     
    8791   } 
    8892 
    89    if ( g_plugins[i].sched != NULL ) 
    90     if ( g_plugins[i].sched->init != NULL ) 
     93   if ( g_plugins[i].sched != NULL ) { 
     94    if ( g_plugins[i].sched->init != NULL ) { 
     95     roar_dl_context_restore(g_plugins[i].lhandle); 
    9196     g_plugins[i].sched->init(); 
     97     roar_dl_context_store(g_plugins[i].lhandle); 
     98    } 
     99   } 
    92100 
    93101   _pp = NULL; 
     
    114122 int i; 
    115123 
    116  for (i = 0; i < MAX_PLUGINS; i++) 
    117   if ( g_plugins[i].lhandle != NULL ) 
    118    if ( g_plugins[i].sched != NULL ) 
    119     if ( g_plugins[i].sched->update != NULL ) 
     124 for (i = 0; i < MAX_PLUGINS; i++) { 
     125  if ( g_plugins[i].lhandle != NULL ) { 
     126   if ( g_plugins[i].sched != NULL ) { 
     127    if ( g_plugins[i].sched->update != NULL ) { 
     128     roar_dl_context_restore(g_plugins[i].lhandle); 
    120129     if ( g_plugins[i].sched->update() == -1 ) 
    121130      ret = -1; 
     131     roar_dl_context_store(g_plugins[i].lhandle); 
     132    } 
     133   } 
     134  } 
     135 } 
    122136 
    123137 return ret; 
     
    178192 } 
    179193 
    180  return clients_register_proto(proto); 
     194 return clients_register_proto(proto, _pp->lhandle); 
    181195} 
    182196 
Note: See TracChangeset for help on using the changeset viewer.