MobilityDB 1.3
Loading...
Searching...
No Matches
Data Structures | Functions
threaded_test.c File Reference

Concurrent stress test for MEOS thread-local state (issue #404). More...

#include <pthread.h>
#include <stdatomic.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <meos.h>
#include <meos_geo.h>

Data Structures

struct  worker_arg
 

Functions

int main (int argc, char **argv)
 
static void * worker (void *arg)
 

Detailed Description

Concurrent stress test for MEOS thread-local state (issue #404).

Each worker thread independently runs the full lifecycle: meos_initialize() → parse a unique WKT temporal point in a hot loop (exercises the per-thread WKT lexer/parser globals + GMT bootstrap) → read-only queries on the parsed value → thread-unique meos_errno round-trip → meos_finalize()

Verifies:

Build (Linux, after cmake --install to a prefix):

gcc -Wall -g -O2 -I<prefix>/include -pthread \
-o threaded_test threaded_test.c -L<prefix>/lib -lmeos
./threaded_test 8 5000 # 8 threads, 5000 iterations each

Run under TSan for race detection: rebuild MEOS and the test with -fsanitize=thread.