Created
July 14, 2021 11:34
-
-
Save jpopesculian/c87ee511ce1e9b259e50910b16b36d84 to your computer and use it in GitHub Desktop.
Zenroom Threaded Bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <pthread.h> | |
#include <zenroom.h> | |
void *zenExec(void *vargp) | |
{ | |
zencode_exec("Scenario 'ecdh': Create the keypair\n\ | |
Given that I am known as 'Alice'\n\ | |
When I create the keypair\n\ | |
Then print my data\n", "", "", ""); | |
return NULL; | |
} | |
int main() | |
{ | |
const int NUM_THREADS = 5; | |
pthread_t thread_ids[NUM_THREADS]; | |
for (int i = 0; i < NUM_THREADS; i++) { | |
pthread_create(&thread_ids[i], NULL, zenExec, NULL); | |
} | |
for (int i = 0; i < NUM_THREADS; i++) { | |
pthread_join(thread_ids[i], NULL); | |
} | |
exit(0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
ZENDIR =../zenroom/src | |
LIBS=-lm -lpthread -lzenroom-x86_64 | |
CFLAGS := -I$(ZENDIR) -L$(ZENDIR) -Wl,-rpath=$(ZENDIR) $(LIBS) | |
OBJ = main.o | |
BIN = main | |
$(BIN): $(OBJ) | |
$(CC) -o $@ $^ $(CFLAGS) | |
%.o: %.c | |
$(CC) -c -o $@ $< $(CFLAGS) | |
.PHONY: clean | |
clean: | |
rm -f $(BIN) | |
rm -f *.o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment