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
7817885d
Commit
7817885d
authored
15 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
replace gang scheduling polling logic with pthread_cond_timedwait()
parent
b8199f90
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/slurmctld/gang.c
+11
-3
11 additions, 3 deletions
src/slurmctld/gang.c
with
11 additions
and
3 deletions
src/slurmctld/gang.c
+
11
−
3
View file @
7817885d
...
@@ -55,6 +55,8 @@
...
@@ -55,6 +55,8 @@
/* global timeslicer thread variables */
/* global timeslicer thread variables */
static
bool
thread_running
=
false
;
static
bool
thread_running
=
false
;
static
bool
thread_shutdown
=
false
;
static
bool
thread_shutdown
=
false
;
static
pthread_mutex_t
term_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_cond_t
term_cond
=
PTHREAD_COND_INITIALIZER
;
static
pthread_mutex_t
thread_flag_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
thread_flag_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_t
timeslicer_thread_id
=
(
pthread_t
)
0
;
static
pthread_t
timeslicer_thread_id
=
(
pthread_t
)
0
;
static
List
preempt_job_list
=
(
List
)
NULL
;
static
List
preempt_job_list
=
(
List
)
NULL
;
...
@@ -1193,7 +1195,10 @@ extern int gs_fini(void)
...
@@ -1193,7 +1195,10 @@ extern int gs_fini(void)
debug3
(
"gang: entering gs_fini"
);
debug3
(
"gang: entering gs_fini"
);
pthread_mutex_lock
(
&
thread_flag_mutex
);
pthread_mutex_lock
(
&
thread_flag_mutex
);
if
(
thread_running
)
{
if
(
thread_running
)
{
pthread_mutex_lock
(
&
term_lock
);
thread_shutdown
=
true
;
thread_shutdown
=
true
;
pthread_cond_signal
(
&
term_cond
);
pthread_mutex_unlock
(
&
term_lock
);
usleep
(
120000
);
usleep
(
120000
);
if
(
timeslicer_thread_id
)
if
(
timeslicer_thread_id
)
error
(
"gang: timeslicer pthread still running"
);
error
(
"gang: timeslicer pthread still running"
);
...
@@ -1535,10 +1540,13 @@ static void _cycle_job_list(struct gs_part *p_ptr)
...
@@ -1535,10 +1540,13 @@ static void _cycle_job_list(struct gs_part *p_ptr)
static
void
_slice_sleep
(
void
)
static
void
_slice_sleep
(
void
)
{
{
int
i
,
cycles
=
timeslicer_seconds
*
10
;
struct
timespec
ts
=
{
0
,
0
}
;
for
(
i
=
0
;
((
i
<
cycles
)
&&
!
thread_shutdown
);
i
++
)
ts
.
tv_sec
=
time
(
NULL
)
+
timeslicer_seconds
;
usleep
(
100000
);
pthread_mutex_lock
(
&
term_lock
);
if
(
!
thread_shutdown
)
pthread_cond_timedwait
(
&
term_cond
,
&
term_lock
,
&
ts
);
pthread_mutex_unlock
(
&
term_lock
);
}
}
/* The timeslicer thread */
/* The timeslicer thread */
...
...
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