Skip to content
Snippets Groups Projects

smoke-test, clang-format, gitlab-ci

Files

+ 10
9
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
 
#include <iostream>
#include <iostream>
#include <list>
#include <list>
#include <string>
#include <string>
#include <thread>
#include <thread>
#include "Runtime.hpp"
#include "Common.hpp"
#include "PrivateSemaphore.hpp"
#include "BinaryPrivateSemaphore.hpp"
#include "BinaryPrivateSemaphore.hpp"
 
#include "Common.hpp"
#include "CountingPrivateSemaphore.hpp"
#include "CountingPrivateSemaphore.hpp"
#include "Debug.hpp"
#include "Debug.hpp"
 
#include "PrivateSemaphore.hpp"
 
#include "Runtime.hpp"
typedef struct {
typedef struct {
int n;
int n;
@@ -18,10 +19,10 @@ typedef struct {
@@ -18,10 +19,10 @@ typedef struct {
PS* sem;
PS* sem;
} fibParams;
} fibParams;
static void fib(void *voidParams) {
static void fib(void* voidParams) {
fibParams* params = static_cast<fibParams*>(voidParams);
fibParams* params = static_cast<fibParams*>(voidParams);
int n = params->n;
int n = params->n;
int *result = params->result;
int* result = params->result;
PS* sem = params->sem;
PS* sem = params->sem;
if (n < 2) {
if (n < 2) {
@@ -61,7 +62,7 @@ static void fibKickoff() {
@@ -61,7 +62,7 @@ static void fibKickoff() {
const int fibNum = 4;
const int fibNum = 4;
int result;
int result;
BPS sem;
BPS sem;
fibParams params = { fibNum, &result, &sem };
fibParams params = {fibNum, &result, &sem};
fib(&params);
fib(&params);
@@ -71,8 +72,8 @@ static void fibKickoff() {
@@ -71,8 +72,8 @@ static void fibKickoff() {
exit(EXIT_SUCCESS);
exit(EXIT_SUCCESS);
}
}
int main(UNUSED_ARG int argc, UNUSED_ARG char *argv[]) {
int main(UNUSED_ARG int argc, UNUSED_ARG char* argv[]) {
//const unsigned nthreads = std::thread::hardware_concurrency();
// const unsigned nthreads = std::thread::hardware_concurrency();
const unsigned nthreads = 2;
const unsigned nthreads = 2;
std::cout << "Number of threads: " << nthreads << std::endl;
std::cout << "Number of threads: " << nthreads << std::endl;
@@ -86,6 +87,6 @@ int main(UNUSED_ARG int argc, UNUSED_ARG char *argv[]) {
@@ -86,6 +87,6 @@ int main(UNUSED_ARG int argc, UNUSED_ARG char *argv[]) {
runtime.schedule(*fibFiber);
runtime.schedule(*fibFiber);
runtime.waitUntilFinished();
runtime.waitUntilFinished();
return 0;
return 0;
}
}
Loading