Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
b1b51f52
Commit
b1b51f52
authored
28 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
mutex locks are now initialized
Rev: src/threads.c:1.5
parent
aef30b92
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/threads.c
+10
-6
10 additions, 6 deletions
src/threads.c
with
10 additions
and
6 deletions
src/threads.c
+
10
−
6
View file @
b1b51f52
...
@@ -10,7 +10,7 @@ struct object *thread_id;
...
@@ -10,7 +10,7 @@ struct object *thread_id;
#ifdef _REENTRANT
#ifdef _REENTRANT
MUTEX_T
interpreter_lock
;
MUTEX_T
interpreter_lock
=
PTHREAD_MUTEX_INITIALIZER
;
struct
program
*
mutex_key
=
0
;
struct
program
*
mutex_key
=
0
;
struct
program
*
thread_id_prog
=
0
;
struct
program
*
thread_id_prog
=
0
;
pthread_attr_t
pattr
;
pthread_attr_t
pattr
;
...
@@ -26,9 +26,13 @@ void *new_thread_func(void * data)
...
@@ -26,9 +26,13 @@ void *new_thread_func(void * data)
struct
thread_starter
arg
=
*
(
struct
thread_starter
*
)
data
;
struct
thread_starter
arg
=
*
(
struct
thread_starter
*
)
data
;
JMP_BUF
back
;
JMP_BUF
back
;
INT32
args
;
INT32
args
;
free
((
char
*
)
data
);
free
((
char
*
)
data
);
if
(
args
=
mt_lock
(
&
interpreter_lock
))
fatal
(
"Failed to lock interpreter, errno %d
\n
"
,
args
);
args
=
arg
.
args
->
size
;
args
=
arg
.
args
->
size
;
mt_lock
(
&
interpreter_lock
);
init_interpreter
();
init_interpreter
();
thread_id
=
arg
.
id
;
thread_id
=
arg
.
id
;
...
@@ -44,13 +48,12 @@ void *new_thread_func(void * data)
...
@@ -44,13 +48,12 @@ void *new_thread_func(void * data)
}
else
{
}
else
{
push_array_items
(
arg
.
args
);
push_array_items
(
arg
.
args
);
arg
.
args
=
0
;
arg
.
args
=
0
;
f_call_function
(
args
);
}
}
UNSETJMP
(
back
);
UNSETJMP
(
back
);
destruct
(
thread_id
);
destruct
(
thread_id
);
free_object
(
thread_id
);
free_object
(
thread_id
);
thread_id
=
0
;
thread_id
=
0
;
...
@@ -60,10 +63,11 @@ void *new_thread_func(void * data)
...
@@ -60,10 +63,11 @@ void *new_thread_func(void * data)
th_exit
(
0
);
th_exit
(
0
);
}
}
void
f_thread_create
(
INT32
args
)
void
f_thread_create
(
INT32
args
)
{
{
struct
thread_starter
*
arg
;
pthread_t
dummy
;
pthread_t
dummy
;
struct
thread_starter
*
arg
;
int
tmp
;
int
tmp
;
arg
=
ALLOC_STRUCT
(
thread_starter
);
arg
=
ALLOC_STRUCT
(
thread_starter
);
arg
->
args
=
aggregate_array
(
args
);
arg
->
args
=
aggregate_array
(
args
);
...
@@ -122,7 +126,7 @@ struct key_storage
...
@@ -122,7 +126,7 @@ struct key_storage
int
initialized
;
int
initialized
;
};
};
static
MUTEX_T
mutex_kluge
;
static
MUTEX_T
mutex_kluge
=
PTHREAD_MUTEX_INITIALIZER
;
#define OB2KEY(X) ((struct key_storage *)((X)->storage))
#define OB2KEY(X) ((struct key_storage *)((X)->storage))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment