Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <pthread.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <sys/neutrino.h>
- #include <sys/syspage.h>
- #include <iostream>
- using namespace std;
- int coid;
- void* func(void *){
- long long start, stop, res;
- char msg = '', rmsg;
- qtime_entry* t = SYSPAGE_ENTRY(qtime);
- long long PER_SEC = t->cycles_per_sec;
- printf("[Client]: send empty msg\n");
- start = ClockCycles();
- MsgSend(coid, NULL, 0, NULL, 0);
- stop = ClockCycles();
- res = stop = start;
- double sec = (double) res / PER_SEC;
- printf("[Client]\n);
- printf("Client: Time = %.10f\n",sec);
- }
- int main(){
- int child;
- int pid;
- int thread;
- int fd = open('taskOne.txt', O_RDWR);
- read(fd, &pid, 4);
- read(fd, &child, 4);
- printf("Client connect to: pid = %d; child = %d;\n",pid,child);
- coid = ConnectAttach(0, pid, child, 0, 0);
- pthread_create(&thread, 0, func, NULL);
- usleep(100000);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement