| 459 | } |
| 460 | |
| 461 | void ServiceEventCreate(ServiceEvent event) |
| 462 | { |
| 463 | ServiceProxy proxy = (ServiceProxy)(((uint8_t*)event) - offsetof(ServiceProxyRecord, creation)); |
| 464 | ServiceThread thread = proxy->server; |
| 465 | //fprintf(stderr, "ServiceEventCreate thread %p proxy %p\n", thread, proxy); |
| 466 | xsBeginHost(thread->the); |
| 467 | { |
| 468 | xsVars(4); |
| 469 | xsTry { |
| 470 | xsVar(0) = xsAwaitImport(proxy->name, XS_IMPORT_DEFAULT); |
| 471 | fxPush(xsVar(0)); |
| 472 | fxNew(the); |
| 473 | if (proxy->reverse) { |
| 474 | xsVar(1) = xsNewHostFunction(ServiceProxyInvoke, 4); |
| 475 | xsVar(2) = xsGet(xsGlobal, xsID_Service); |
| 476 | xsVar(2) = xsGet(xsVar(2), xsID_prototype); |
| 477 | xsVar(3) = xsGet(xsGlobal, xsID_Object); |
| 478 | xsVar(3) = xsCall1(xsVar(3), xsID_create, xsVar(2)); |
| 479 | proxy->reverse->usage++; |
| 480 | xsSetHostData(xsVar(3), proxy->reverse); |
| 481 | proxy->reverse = NULL; |
| 482 | xsVar(2) = xsNew2(xsGlobal, xsID_Proxy, xsVar(1), xsVar(3)); |
| 483 | fxPush(xsVar(2)); |
| 484 | fxRunCount(the, 1); |
| 485 | } |
| 486 | else |
| 487 | fxRunCount(the, 0); |
| 488 | proxy->behavior = fxPop(); |
| 489 | } |
| 490 | xsCatch { |
| 491 | } |
| 492 | proxy->nextProxy = thread->firstProxy; |
| 493 | thread->firstProxy = proxy; |
| 494 | } |
| 495 | xsEndHost(thread->the); |
| 496 | } |
| 497 | |
| 498 | void ServiceEventDelete(ServiceEvent event) |
| 499 | { |
nothing calls this directly
no test coverage detected