Skip to content
Permalink
Browse files
update
  • Loading branch information
carey committed Dec 21, 2020
1 parent 89b9378 commit 99de68bae32cb719eb3cc81346bbed3a2a999561
Show file tree
Hide file tree
Showing 146 changed files with 25,071 additions and 0 deletions.
@@ -0,0 +1,41 @@
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <fstream>
#include <chrono>
#include <mutex>
#include <condition_variable>

using namespace std;

mutex mtx;
condition_variable condVar;
int threadControlInt = 2;

void thread1() {
using namespace std::this_thread;
const int t1ID = 1;
std::unique_lock<std::mutex> lck(mtx);
while (threadControlInt!=t1ID) {
condVar.wait(lck);
}
lck.unlock();
cout << // information telling you which thread is running: "
sleep_for(std::chrono::seconds(2)); // introduced delay
lck.lock();
threadControlInt = 4;
lck.unlock();
condVar.notify_all();
}


int main(void) {

thread t1(thread1);

t1.join();

return 0;

}
@@ -0,0 +1,20 @@
A free bird leaps
on the back of the wind
and floats downstream
till the current ends
and dips his wing
in the orange sun rays
and dares to claim the sky.

But a bird that stalks
down his narrow cage
can seldom see through
his bars of rage
his wings are clipped and
his feet are tied
so he opens his throat to sing.

This base code still needs to be put into a working program, and will not work
without further alterations in your program, as I've cut bits out.
It exists primarily to demonstrate the logic flow and to provide a template to
work from.
@@ -0,0 +1,43 @@
A free bird leaps
on the back of the wind
and floats downstream
till the current ends
and dips his wing
in the orange sun rays
and dares to claim the sky.

But a bird that stalks
down his narrow cage
can seldom see through
his bars of rage
his wings are clipped and
his feet are tied
so he opens his throat to sing.

The caged bird sings
with a fearful trill
of things unknown
but longed for still
and his tune is heard
on the distant hill
for the caged bird
sings of freedom.

The free bird thinks of another breeze
and the trade winds soft through the sighing trees
and the fat worms waiting on a dawn bright lawn
and he names the sky his own

But a caged bird stands on the grave of dreams
his shadow shouts on a nightmare scream
his wings are clipped and his feet are tied
so he opens his throat to sing.

The caged bird sings
with a fearful trill
of things unknown
but longed for still
and his tune is heard
on the distant hill
for the caged bird
sings of freedom.
@@ -0,0 +1,22 @@
CC = g++ -std=c++0x -lpthread
CFLAGS = -Wall -O3
LDFLAGS =

#----------

EXE = fluffypinkunicornsaregreat

OBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp))

#----------

$(EXE): $(OBJS)
$(CC) $(OBJS) $(LIB_DIRS) $(LLIBS)$(LDFLAGS) -o $(EXE)

$(OBJS): %.o : %.cpp
$(CC) $(CFLAGS) -c $<

#----------

clean:
rm -f *.o *.*~ *~ $(EXE)
@@ -0,0 +1,17 @@
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <thread>

void thread1(std::string whatever)
{
std::cout << "thread1 says: " << whatever << std::endl;
}


int main (void){

std::thread t1(thread1,"Frappucino is just ice cream with extra steps");
t1.join(); // This join after thread launch is important, since without it, if your main function exits with tasks still on the stack there will be unpredictable behaviour, possibly crashes.
return 0;
}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,32 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
@@ -0,0 +1,29 @@
#################################################
# Makefile for 370ct #
#################################################

CC = gcc
CFLAGS = -Wall
LLIBS = -lm -lpthread
EXE = prodcon

OBJS = $(patsubst %.c,%.o,$(wildcard *.c))

#----------
hmx: $(OBJS)
$(CC) $(LLIBS) $(OBJS) -o $(EXE)
rm -f *.o *~

#----------

$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $<

#----------

clean:
rm -f *.o *.*~ *~ $(EXE)

#----------


0 comments on commit 99de68b

Please sign in to comment.