Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
c6e3eae7
Commit
c6e3eae7
authored
Jun 01, 2012
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smp_thread() stopping
parent
b04b136c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
10 deletions
+35
-10
storage_persistent.c
bin/varnishd/storage/storage_persistent.c
+33
-10
storage_persistent.h
bin/varnishd/storage/storage_persistent.h
+2
-0
No files found.
bin/varnishd/storage/storage_persistent.c
View file @
c6e3eae7
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
#include "vcli_priv.h"
#include "vcli_priv.h"
#include "vend.h"
#include "vend.h"
#include "vsha256.h"
#include "vsha256.h"
#include "vtim.h"
#include "persistent.h"
#include "persistent.h"
#include "storage/storage_persistent.h"
#include "storage/storage_persistent.h"
...
@@ -287,15 +288,24 @@ smp_thread(struct worker *wrk, void *priv)
...
@@ -287,15 +288,24 @@ smp_thread(struct worker *wrk, void *priv)
BAN_TailDeref
(
&
sc
->
tailban
);
BAN_TailDeref
(
&
sc
->
tailban
);
AZ
(
sc
->
tailban
);
AZ
(
sc
->
tailban
);
printf
(
"Silo completely loaded
\n
"
);
printf
(
"Silo completely loaded
\n
"
);
while
(
1
)
{
(
void
)
sleep
(
1
);
/* Housekeeping loop */
Lck_Lock
(
&
sc
->
mtx
);
while
(
!
(
sc
->
flags
&
SMP_SC_STOP
))
{
sg
=
VTAILQ_FIRST
(
&
sc
->
segments
);
sg
=
VTAILQ_FIRST
(
&
sc
->
segments
);
if
(
sg
!=
NULL
&&
sg
->
sc
->
cur_seg
&&
sg
->
nobj
==
0
)
{
if
(
sg
!=
NULL
&&
sg
!=
sc
->
cur_seg
&&
sg
->
nobj
==
0
)
Lck_Lock
(
&
sc
->
mtx
);
smp_save_segs
(
sc
);
smp_save_segs
(
sc
);
Lck_Unlock
(
&
sc
->
mtx
);
}
Lck_Unlock
(
&
sc
->
mtx
);
VTIM_sleep
(
3
.
14159265359
-
2
);
Lck_Lock
(
&
sc
->
mtx
);
}
}
smp_save_segs
(
sc
);
Lck_Unlock
(
&
sc
->
mtx
);
pthread_exit
(
0
);
NEEDLESS_RETURN
(
NULL
);
NEEDLESS_RETURN
(
NULL
);
}
}
...
@@ -307,7 +317,6 @@ static void
...
@@ -307,7 +317,6 @@ static void
smp_open
(
const
struct
stevedore
*
st
)
smp_open
(
const
struct
stevedore
*
st
)
{
{
struct
smp_sc
*
sc
;
struct
smp_sc
*
sc
;
pthread_t
pt
;
ASSERT_CLI
();
ASSERT_CLI
();
...
@@ -349,7 +358,7 @@ smp_open(const struct stevedore *st)
...
@@ -349,7 +358,7 @@ smp_open(const struct stevedore *st)
smp_new_seg
(
sc
);
smp_new_seg
(
sc
);
/* Start the worker silo worker thread, it will load the objects */
/* Start the worker silo worker thread, it will load the objects */
WRK_BgThread
(
&
pt
,
"persistence"
,
smp_thread
,
sc
);
WRK_BgThread
(
&
sc
->
bgthread
,
"persistence"
,
smp_thread
,
sc
);
VTAILQ_INSERT_TAIL
(
&
silos
,
sc
,
list
);
VTAILQ_INSERT_TAIL
(
&
silos
,
sc
,
list
);
Lck_Unlock
(
&
sc
->
mtx
);
Lck_Unlock
(
&
sc
->
mtx
);
...
@@ -360,7 +369,7 @@ smp_open(const struct stevedore *st)
...
@@ -360,7 +369,7 @@ smp_open(const struct stevedore *st)
*/
*/
static
void
static
void
smp_close
(
const
struct
stevedore
*
st
)
smp_
signal_
close
(
const
struct
stevedore
*
st
)
{
{
struct
smp_sc
*
sc
;
struct
smp_sc
*
sc
;
...
@@ -371,9 +380,22 @@ smp_close(const struct stevedore *st)
...
@@ -371,9 +380,22 @@ smp_close(const struct stevedore *st)
if
(
sc
->
cur_seg
!=
NULL
)
if
(
sc
->
cur_seg
!=
NULL
)
smp_close_seg
(
sc
,
sc
->
cur_seg
);
smp_close_seg
(
sc
,
sc
->
cur_seg
);
AZ
(
sc
->
cur_seg
);
AZ
(
sc
->
cur_seg
);
sc
->
flags
|=
SMP_SC_STOP
;
Lck_Unlock
(
&
sc
->
mtx
);
Lck_Unlock
(
&
sc
->
mtx
);
}
static
void
smp_close
(
const
struct
stevedore
*
st
)
{
struct
smp_sc
*
sc
;
void
*
status
;
ASSERT_CLI
();
CAST_OBJ_NOTNULL
(
sc
,
st
->
priv
,
SMP_SC_MAGIC
);
/* XXX: reap thread */
pthread_join
(
sc
->
bgthread
,
&
status
);
AZ
(
status
);
}
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
...
@@ -561,6 +583,7 @@ const struct stevedore smp_stevedore = {
...
@@ -561,6 +583,7 @@ const struct stevedore smp_stevedore = {
.
alloc
=
smp_alloc
,
.
alloc
=
smp_alloc
,
.
allocobj
=
smp_allocobj
,
.
allocobj
=
smp_allocobj
,
.
free
=
smp_free
,
.
free
=
smp_free
,
.
signal_close
=
smp_signal_close
,
};
};
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
...
...
bin/varnishd/storage/storage_persistent.h
View file @
c6e3eae7
...
@@ -104,8 +104,10 @@ struct smp_sc {
...
@@ -104,8 +104,10 @@ struct smp_sc {
#define SMP_SC_MAGIC 0x7b73af0a
#define SMP_SC_MAGIC 0x7b73af0a
struct
stevedore
*
parent
;
struct
stevedore
*
parent
;
pthread_t
bgthread
;
unsigned
flags
;
unsigned
flags
;
#define SMP_SC_LOADED (1 << 0)
#define SMP_SC_LOADED (1 << 0)
#define SMP_SC_STOP (1 << 1)
const
struct
stevedore
*
stevedore
;
const
struct
stevedore
*
stevedore
;
int
fd
;
int
fd
;
...
...
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