Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osv
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
Package registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verlässliche Systemsoftware
projects
osv
Commits
ff1fb4da
Commit
ff1fb4da
authored
12 years ago
by
Avi Kivity
Browse files
Options
Downloads
Patches
Plain Diff
sched: default thread attributes
This makes it easier to create a thread with no special properties.
parent
1c6641c2
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
core/sched.cc
+2
-2
2 additions, 2 deletions
core/sched.cc
drivers/virtio-blk.cc
+1
-4
1 addition, 4 deletions
drivers/virtio-blk.cc
drivers/virtio-vring.cc
+1
-4
1 addition, 4 deletions
drivers/virtio-vring.cc
include/sched.hh
+6
-6
6 additions, 6 deletions
include/sched.hh
loader.cc
+2
-5
2 additions, 5 deletions
loader.cc
with
12 additions
and
21 deletions
core/sched.cc
+
2
−
2
View file @
ff1fb4da
...
...
@@ -86,12 +86,12 @@ void thread::yield()
}
thread
::
stack_info
::
stack_info
()
:
begin
(
),
size
(
)
:
begin
(
malloc
(
65536
)),
size
(
65536
),
owned
(
true
)
{
}
thread
::
stack_info
::
stack_info
(
void
*
_begin
,
size_t
_size
)
:
begin
(
_begin
),
size
(
_size
)
:
begin
(
_begin
),
size
(
_size
)
,
owned
(
false
)
{
auto
end
=
align_down
(
begin
+
size
,
16
);
size
=
static_cast
<
char
*>
(
end
)
-
static_cast
<
char
*>
(
begin
);
...
...
This diff is collapsed.
Click to expand it.
drivers/virtio-blk.cc
+
1
−
4
View file @
ff1fb4da
...
...
@@ -98,10 +98,7 @@ struct driver virtio_blk_driver = {
sizeof
(
_config
.
capacity
));
debug
(
fmt
(
"capacity of the device is %x"
)
%
(
u64
)
_config
.
capacity
);
void
*
stk1
=
malloc
(
10000
);
thread
::
attr
attr
;
attr
.
stack
=
{
stk1
,
10000
};
thread
*
worker
=
new
thread
([
this
]
{
this
->
response_worker
();
}
,
attr
);
thread
*
worker
=
new
thread
([
this
]
{
this
->
response_worker
();
});
worker
->
wake
();
// just to keep gcc happy about unused var
_dev
->
add_dev_status
(
VIRTIO_CONFIG_S_DRIVER_OK
);
...
...
This diff is collapsed.
Click to expand it.
drivers/virtio-vring.cc
+
1
−
4
View file @
ff1fb4da
...
...
@@ -44,11 +44,8 @@ namespace virtio {
_avail_count
=
num
;
msix_isr_list
*
isrs
=
new
msix_isr_list
;
void
*
stk1
=
malloc
(
10000
);
_callback
=
nullptr
;
thread
::
attr
attr
;
attr
.
stack
=
{
stk1
,
10000
};
thread
*
isr
=
new
thread
([
this
]
{
if
(
_callback
)
_callback
();
},
attr
);
thread
*
isr
=
new
thread
([
this
]
{
if
(
_callback
)
_callback
();
});
isrs
->
insert
(
std
::
make_pair
(
_q_index
,
isr
));
interrupt_manager
::
instance
()
->
easy_register
(
_dev
,
*
isrs
);
...
...
This diff is collapsed.
Click to expand it.
include/sched.hh
+
6
−
6
View file @
ff1fb4da
...
...
@@ -52,15 +52,19 @@ private:
class
thread
{
public:
class
attr
;
struct
stack_info
{
stack_info
();
stack_info
(
void
*
begin
,
size_t
size
);
void
*
begin
;
size_t
size
;
bool
owned
;
// by thread
};
struct
attr
{
stack_info
stack
;
};
public
:
explicit
thread
(
std
::
function
<
void
()
>
func
,
attr
attributes
,
explicit
thread
(
std
::
function
<
void
()
>
func
,
attr
attributes
=
attr
()
,
bool
main
=
false
);
~
thread
();
template
<
class
Pred
>
...
...
@@ -109,10 +113,6 @@ public:
bi
::
list_member_hook
<>
_thread_list_link
;
};
struct
thread
::
attr
{
stack_info
stack
;
};
class
timer_list
{
public:
void
fired
();
...
...
This diff is collapsed.
Click to expand it.
loader.cc
+
2
−
5
View file @
ff1fb4da
...
...
@@ -121,11 +121,8 @@ void test_threads()
test_threads_data
tt
;
tt
.
main
=
thread
::
current
();
tt
.
t1ok
=
tt
.
t2ok
=
true
;
thread
::
attr
attr1
,
attr2
;
attr1
.
stack
=
{
new
char
[
10000
],
10000
};
attr2
.
stack
=
{
new
char
[
10000
],
10000
};
tt
.
t1
=
new
thread
([
&
]
{
test_thread_1
(
tt
);
},
attr1
);
tt
.
t2
=
new
thread
([
&
]
{
test_thread_2
(
tt
);
},
attr2
);
tt
.
t1
=
new
thread
([
&
]
{
test_thread_1
(
tt
);
});
tt
.
t2
=
new
thread
([
&
]
{
test_thread_2
(
tt
);
});
thread
::
wait_until
([
&
]
{
return
test_ctr
>=
1000
;
});
tt
.
t1
->
join
();
tt
.
t2
->
join
();
...
...
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