-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsubmit.c
More file actions
51 lines (39 loc) · 1.54 KB
/
Copy pathsubmit.c
File metadata and controls
51 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <pthread.h>
#include <stdio.h>
#include "simos.h"
//===============================================================
// The interface to interact with clients
// current implementation is to get one client input from stdin
// --------------------------
// Should change to create server socket to accept client connections
// and then poll client ports to get their inputs.
// -- Best is to use the select function to get client inputs
// Also, during execution, the terminal output (term.c) should be
// sent back to the client and client prints on its terminal.
//===============================================================
void one_submission ()
{ char fname[100];
printf ("Submission file: ");
scanf ("%s", &fname);
if (Debug) printf ("File name: %s has been submitted\n", fname);
submit_process (fname);
}
void *process_submissions ()
{ char action;
char fname[100];
while (systemActive) one_submission ();
printf ("Client submission interface loop has ended!\n");
}
// submission thread is not activated due to input competition
pthread_t submissionThread;
void start_client_submission ()
{ int ret;
ret = pthread_create (&submissionThread, NULL, process_submissions, NULL);
if (ret < 0) printf ("Client submission thread creation problem\n");
else printf ("Client submission interface has been created successsfully\n");
}
void end_client_submission ()
{ int ret;
ret = pthread_join (submissionThread, NULL);
printf ("Client submission interface has finished %d\n", ret);
}