MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / UDSThread

Function UDSThread

Applications/IPCTest/main.cpp:22–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21sockaddr_un udsAddr;
22void* UDSThread(void* n){
23 int udsClient = socket(AF_UNIX, SOCK_STREAM, 0);
24 if(connect(udsClient, reinterpret_cast<sockaddr*>(&udsAddr), sizeof(sockaddr_un))){
25 perror("Error connecting to socket:");
26 exit(1);
27 }
28
29 char buf[64];
30 for(int i = 0; i < msgCount; i++){
31 recv(udsClient, buf, 64, 0);
32
33 clock_gettime(CLOCK_BOOTTIME, &newTimer[i]);
34 }
35
36 int low = newTimer[0] - timer[0];
37 int high = 0;
38 for(int i = 0; i < msgCount; i++){
39 int diff = (newTimer[i] - timer[i]);
40 if(diff / 1000 < low){
41 low = diff / 1000;
42 }
43
44 if(diff / 1000 > high){
45 high = diff / 1000;
46 }
47
48 avgTime += diff;
49 }
50 avgTime = avgTime / msgCount / 1000;
51
52 printf("Recieved messagees: avg time: %ldus, low: %dus, high %dus\n", avgTime, low, high);
53
54 close(udsClient);
55
56 return nullptr;
57}
58
59void* LemonIPCThread(void* n){
60 long endpHandle = syscall(SYS_INTERFACE_CONNECT, "lemon.testservice/testif", 0, 0, 0, 0);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected