LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/thread - descriptor.pgc (source / functions) Coverage Total Hit
Test: Code coverage Lines: 0.0 % 17 0
Test Date: 2026-01-26 10:56:24 Functions: 0.0 % 2 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : #ifdef WIN32
       2              : #define WIN32_LEAN_AND_MEAN
       3              : #include <windows.h>
       4              : #include <process.h>
       5              : #include <locale.h>
       6              : #else
       7              : #include <pthread.h>
       8              : #endif
       9              : #include <stdio.h>
      10              : 
      11              : #define THREADS         16
      12              : #define REPEATS         50000
      13              : 
      14              : EXEC SQL include sqlca;
      15              : EXEC SQL whenever sqlerror sqlprint;
      16              : EXEC SQL whenever not found sqlprint;
      17              : 
      18              : #if defined(WIN32)
      19              : static unsigned __stdcall fn(void* arg)
      20              : #else
      21            0 : static void* fn(void* arg)
      22              : #endif
      23              : {
      24            0 :         int i;
      25              : 
      26            0 :         for (i = 1; i <= REPEATS; ++i)
      27              :         {
      28            0 :                 EXEC SQL ALLOCATE DESCRIPTOR mydesc;
      29            0 :                 EXEC SQL DEALLOCATE DESCRIPTOR mydesc;
      30            0 :         }
      31              : 
      32            0 :         return 0;
      33            0 : }
      34              : 
      35            0 : int main ()
      36              : {
      37            0 :         int i;
      38              : #ifdef WIN32
      39              :         HANDLE threads[THREADS];
      40              : #else
      41            0 :         pthread_t threads[THREADS];
      42              : #endif
      43              : 
      44              : #ifdef WIN32
      45              :         for (i = 0; i < THREADS; ++i)
      46              :         {
      47              :                 unsigned id;
      48              :                 threads[i] = (HANDLE)_beginthreadex(NULL, 0, fn, NULL, 0, &id);
      49              :         }
      50              : 
      51              :         WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE);
      52              :         for (i = 0; i < THREADS; ++i)
      53              :                 CloseHandle(threads[i]);
      54              : #else
      55            0 :         for (i = 0; i < THREADS; ++i)
      56            0 :                 pthread_create(&threads[i], NULL, fn, NULL);
      57            0 :         for (i = 0; i < THREADS; ++i)
      58            0 :                 pthread_join(threads[i], NULL);
      59              : #endif
      60              : 
      61            0 :         return 0;
      62            0 : }
        

Generated by: LCOV version 2.3.2-1