Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
6e69f3eb
Commit
6e69f3eb
authored
19 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Experiment with pthread_attr
parent
a59adec5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbcast/agent.c
+7
-5
7 additions, 5 deletions
src/sbcast/agent.c
with
7 additions
and
5 deletions
src/sbcast/agent.c
+
7
−
5
View file @
6e69f3eb
...
...
@@ -126,6 +126,7 @@ extern void send_rpc(file_bcast_msg_t *bcast_msg,
int
i
,
rc
=
SLURM_SUCCESS
;
int
retries
=
0
;
thd_t
thread_info
[
MAX_THREADS
];
pthread_attr_t
attr
;
if
(
threads_used
==
0
)
{
hostlist_t
hl
;
...
...
@@ -161,16 +162,17 @@ extern void send_rpc(file_bcast_msg_t *bcast_msg,
debug
(
"using %d threads"
,
threads_used
);
}
slurm_attr_init
(
&
attr
);
if
(
pthread_attr_setdetachstate
(
&
attr
,
PTHREAD_CREATE_JOINABLE
))
error
(
"pthread_attr_setdetachstate error %m"
);
for
(
i
=
0
;
i
<
threads_used
;
i
++
)
{
pthread_attr_t
attr
;
slurm_mutex_lock
(
&
agent_cnt_mutex
);
agent_cnt
++
;
slurm_mutex_unlock
(
&
agent_cnt_mutex
);
slurm_attr_init
(
&
attr
);
if
(
pthread_attr_setdetachstate
(
&
attr
,
PTHREAD_CREATE_JOINABLE
))
error
(
"pthread_attr_setdetachstate error %m"
);
thread_info
[
i
].
msg
=
&
msg
[
i
];
while
(
pthread_create
(
&
thread_info
[
i
].
thread
,
&
attr
,
_agent_thread
,
...
...
@@ -180,7 +182,6 @@ extern void send_rpc(file_bcast_msg_t *bcast_msg,
fatal
(
"Can't create pthread"
);
sleep
(
1
);
/* sleep and retry */
}
pthread_attr_destroy
(
&
attr
);
}
/* wait until pthreads complete */
...
...
@@ -188,6 +189,7 @@ extern void send_rpc(file_bcast_msg_t *bcast_msg,
while
(
agent_cnt
)
pthread_cond_wait
(
&
agent_cnt_cond
,
&
agent_cnt_mutex
);
slurm_mutex_unlock
(
&
agent_cnt_mutex
);
pthread_attr_destroy
(
&
attr
);
for
(
i
=
0
;
i
<
threads_used
;
i
++
)
rc
=
MAX
(
rc
,
thread_info
[
i
].
rc
);
...
...
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