Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
5a0d31d3
Commit
5a0d31d3
authored
Oct 02, 2007
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made new test also work without threading enabled.
parent
b5efdbac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
src/interfaces/ecpg/test/expected/thread-descriptor.c
src/interfaces/ecpg/test/expected/thread-descriptor.c
+14
-8
src/interfaces/ecpg/test/thread/descriptor.pgc
src/interfaces/ecpg/test/thread/descriptor.pgc
+7
-1
No files found.
src/interfaces/ecpg/test/expected/thread-descriptor.c
View file @
5a0d31d3
...
...
@@ -8,6 +8,7 @@
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
#line 1 "descriptor.pgc"
#ifdef ENABLE_THREAD_SAFETY
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
...
...
@@ -15,6 +16,7 @@
#else
#include <pthread.h>
#endif
#endif
#include <stdio.h>
#define THREADS 16
...
...
@@ -89,19 +91,19 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
#line 1
3
"descriptor.pgc"
#line 1
5
"descriptor.pgc"
/* exec sql whenever sqlerror sqlprint ; */
#line 1
4
"descriptor.pgc"
#line 1
6
"descriptor.pgc"
/* exec sql whenever not found sqlprint ; */
#line 1
5
"descriptor.pgc"
#line 1
7
"descriptor.pgc"
#ifdef WIN32
static
unsigned
STDCALL
fn
(
void
*
arg
)
#else
void
*
fn
(
void
*
arg
)
static
void
*
fn
(
void
*
arg
)
#endif
{
int
i
;
...
...
@@ -109,16 +111,16 @@ void* fn(void* arg)
for
(
i
=
1
;
i
<=
REPEATS
;
++
i
)
{
ECPGallocate_desc
(
__LINE__
,
"mydesc"
);
#line 2
7
"descriptor.pgc"
#line 2
9
"descriptor.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line 2
7
"descriptor.pgc"
#line 2
9
"descriptor.pgc"
ECPGdeallocate_desc
(
__LINE__
,
"mydesc"
);
#line
28
"descriptor.pgc"
#line
30
"descriptor.pgc"
if
(
sqlca
.
sqlcode
<
0
)
sqlprint
();
#line
28
"descriptor.pgc"
#line
30
"descriptor.pgc"
}
...
...
@@ -127,6 +129,7 @@ if (sqlca.sqlcode < 0) sqlprint();
int
main
(
int
argc
,
char
**
argv
)
{
#ifdef ENABLE_THREAD_SAFETY
int
i
;
#ifdef WIN32
HANDLE
threads
[
THREADS
];
...
...
@@ -150,6 +153,9 @@ int main (int argc, char** argv)
for
(
i
=
0
;
i
<
THREADS
;
++
i
)
pthread_join
(
threads
[
i
],
NULL
);
#endif
#else
fn
(
NULL
);
#endif
return
0
;
}
src/interfaces/ecpg/test/thread/descriptor.pgc
View file @
5a0d31d3
#ifdef ENABLE_THREAD_SAFETY
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
...
...
@@ -5,6 +6,7 @@
#else
#include <pthread.h>
#endif
#endif
#include <stdio.h>
#define THREADS 16
...
...
@@ -17,7 +19,7 @@ EXEC SQL whenever not found sqlprint;
#ifdef WIN32
static unsigned STDCALL fn(void* arg)
#else
void* fn(void* arg)
static
void* fn(void* arg)
#endif
{
int i;
...
...
@@ -33,6 +35,7 @@ void* fn(void* arg)
int main (int argc, char** argv)
{
#ifdef ENABLE_THREAD_SAFETY
int i;
#ifdef WIN32
HANDLE threads[THREADS];
...
...
@@ -56,6 +59,9 @@ int main (int argc, char** argv)
for (i = 0; i < THREADS; ++i)
pthread_join(threads[i], NULL);
#endif
#else
fn(NULL);
#endif
return 0;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment