Skip to content

Commit 96c71d6

Browse files
authored
Small edit to documentation
Added language highlighting
1 parent e8c4017 commit 96c71d6

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

README.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,56 @@ Job is a class that contains your functions and can execute and cancel async.
77
Jobs are required for the JobManager class.
88
### Example
99

10-
11-
12-
Job j = new Job(() =>
13-
{
14-
Console.WriteLine("Job1");
15-
});
16-
17-
//runs the job optional parameter of how many times to execute
18-
j.execute();
19-
20-
//runs the job async optional parameter of how many times to execute
21-
j.executeAsync();
22-
23-
//cancels the execution of the job if its running async
24-
j.cancelExecution();
25-
10+
11+
```csharp
12+
Job j = new Job(() =>
13+
{
14+
Console.WriteLine("Job1");
15+
});
16+
17+
//runs the job optional parameter of how many times to execute
18+
j.execute();
19+
20+
//runs the job async optional parameter of how many times to execute
21+
j.executeAsync();
22+
23+
//cancels the execution of the job if its running async
24+
j.cancelExecution();
25+
```
2626
## JobManager
2727

2828
JobManager is a class you can provide a list of jobs too and the amount of threads you want to execute the jobs with.
2929
### Example
3030

31-
List<Job> joblist = new List<Job>();
32-
//Creating a 100 jobs to execute
33-
for (int i = 0; i < 100; i++)
31+
32+
```csharp
33+
List<Job> joblist = new List<Job>();
34+
//Creating a 100 jobs to execute
35+
for (int i = 0; i < 100; i++)
36+
{
37+
int e = i;
38+
Job j = new Job(() =>
3439
{
35-
int e = i;
36-
Job j = new Job(() =>
37-
{
38-
Console.WriteLine("Job"+e);
39-
});
40-
joblist.Add(j);
41-
}
42-
43-
//Creates a jobmanager class with our list and 10 threads to execute them with
44-
JobManager jobManager = new JobManager(joblist, 10);
45-
46-
//Call this function everytime you create a jobmanager class and everytime you remove or add a job using addJob() or removeJob()
47-
jobManager.setThreads();
48-
49-
//Starts the execution of the jobs
50-
jobManager.startThreads();
40+
Console.WriteLine("Job"+e);
41+
});
42+
joblist.Add(j);
43+
}
5144

52-
//Returns true if all threads are done
53-
jobManager.isDone();
45+
//Creates a jobmanager class with our list and 10 threads to execute them with
46+
JobManager jobManager = new JobManager(joblist, 10);
5447

55-
//Stops the threads from proceeding to the next queued job and terminates them
56-
jobManager.killThreads();
48+
//Call this function everytime you create a jobmanager class and everytime you remove or add a job using addJob() or removeJob()
49+
jobManager.setThreads();
5750

51+
//Starts the execution of the jobs
52+
jobManager.startThreads();
5853

54+
//Returns true if all threads are done
55+
bool done = jobManager.isDone();
5956

57+
//Stops the threads from proceeding to the next queued job and terminates them
58+
jobManager.killThreads();
59+
```
6060
## Notes:
6161

6262
- Do not use more threads than the amount of jobs.

0 commit comments

Comments
 (0)