add readme and update makefile
This commit is contained in:
parent
9aa7973d2f
commit
2c867d2bea
2 changed files with 42 additions and 1 deletions
|
@ -2,7 +2,7 @@ CC=gcc --std=gnu99 -g
|
|||
output=myCounter
|
||||
|
||||
all: main.c main.h
|
||||
$(CC) main.c -o $(output)
|
||||
$(CC) main.c -lpthread -o $(output)
|
||||
|
||||
clean:
|
||||
rm -fr *.o vgcore.* $(output)
|
||||
|
|
41
threads/readme.md
Normal file
41
threads/readme.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
# myCounter
|
||||
|
||||
My Counter is an implementation of a threaded producer consumer architecture.
|
||||
In this implementation, the producer (main thread) increments the counter and
|
||||
the consumer (spawned thread) prints out the changes to myCount. Some status
|
||||
updates about the locking, waiting, and signaling of threads and mutexes are
|
||||
printed to the output as well.
|
||||
|
||||
|
||||
## Compiling
|
||||
|
||||
You can compile this program by using the make command or by hand.
|
||||
|
||||
Simply type:
|
||||
|
||||
```
|
||||
make
|
||||
```
|
||||
|
||||
or, to manually compile, type:
|
||||
|
||||
```
|
||||
gcc -std=c99 main.c -lpthread -o myCounter
|
||||
```
|
||||
|
||||
## Running
|
||||
|
||||
To run, type:
|
||||
|
||||
```
|
||||
make run
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
./myCounter
|
||||
```
|
||||
|
||||
to run manually
|
Loading…
Reference in a new issue