Skip to content

Instantly share code, notes, and snippets.

// ISU laboratory session #11, exercise #1.2
#include <sys/wait.h>
#include <iostream>
using namespace std;
int main()
{
int i;
// ISU laboratory session #11, exercise #1.2
#include <sys/wait.h>
#include <iostream>
using namespace std;
int main()
{
int i;
// ISU laboratory session #11, exercise #1.2
#include <sys/wait.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cerrno>
using namespace std;
// Prototypes:
#include <Publisher.hpp>
#include <MessageDistributionSystem.hpp>
#include <osapi/Log.hpp>
static const int MAX_QUEUE_SIZE=10;
Publisher::Publisher()
: running_(true),
mq_(MAX_QUEUE_SIZE),
timer_(osapi::createNewTimer(&mq_, ID_TIME_OUT))
#include <osapi/Log.hpp>
#include <Subscriber.hpp>
#include <MessageDistributionSystem.hpp>
static const int MAX_QUEUE_SIZE=10;
Subscriber::Subscriber(unsigned int subId)
: mq_(MAX_QUEUE_SIZE), subId_(subId)
{
#include <MessageDistributionSystem.hpp>
#include <iostream>
using namespace std;
void MessageDistributionSystem::subscribe(const std::string& msgId,
osapi::MsgQueue* mq,
unsigned long id)
{
/* Something missing */
#include <SubscriberId.hpp>
namespace details
{
SubscriberId::SubscriberId(osapi::MsgQueue* mq, unsigned long id)
{
/* Make your own implementation here... */
// New code starts
@adurpas
adurpas / Makefile
Created December 3, 2012 14:56
example/Makefile
SRCS=main.cpp KeyBoardInput.cpp LogSystem.cpp
OBJS=$(SRCS:.cpp=.o)
#BASEPATH=..
BASEPATH=~/Documents/Lab8/Ex1
ifeq (${TARGET},host)
# We need to include host specific things
#include ../compiler_setup.host
include ~/Documents/Lab8/Ex1/compiler_setup.host
endif
# Quick and very dirty!
BASEPATH=~/Documents/Lab8/Ex1
# Which target? set default
ifndef TARGET
TARGET=host
#TARGET=target
endif
// ISU laboratory session #8, exercise #1.
#include <osapi/Thread.hpp>
namespace osapi
{
void* ThreadFunctor::threadMapper(void* thread)
{
/* Something is missing here - Determine what! */
// New code starts
ThreadFunctor *tf = static_cast<ThreadFunctor*>(thread);