Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
scan-filesystem
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
scan-filesystem
Commits
ea6ba5dd
Commit
ea6ba5dd
authored
Jan 05, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt to compiler changes
parent
90392daf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
cython/main.pyx
cython/main.pyx
+5
-5
cython/runtime/runtime.pxd
cython/runtime/runtime.pxd
+15
-15
No files found.
cython/main.pyx
View file @
ea6ba5dd
...
...
@@ -15,7 +15,7 @@ from stdlib.dirent cimport DIR, struct_dirent, opendir, readdir, closedir
from
posix.unistd
cimport
readlink
cdef
lock
ed
Scheduler
scheduler
cdef
lock
Scheduler
scheduler
cdef
cypclass
Node
activable
:
...
...
@@ -31,7 +31,7 @@ cdef cypclass Node activable:
self
.
name
=
name
self
.
st
=
st
void
build_node
(
self
,
lock
ed
cyplist
[
dev_t
]
dev_whitelist
,
locked
cyplist
[
string
]
ignore_paths
):
void
build_node
(
self
,
lock
cyplist
[
dev_t
]
dev_whitelist
,
lock
cyplist
[
string
]
ignore_paths
):
# abstract
pass
...
...
@@ -73,7 +73,7 @@ cdef cypclass DirNode(Node):
self
.
children
=
new
cyplist
[
active
Node
]()
self
.
children
.
__init__
()
void
build_node
(
self
,
lock
ed
cyplist
[
dev_t
]
dev_whitelist
,
locked
cyplist
[
string
]
ignore_paths
):
void
build_node
(
self
,
lock
cyplist
[
dev_t
]
dev_whitelist
,
lock
cyplist
[
string
]
ignore_paths
):
cdef
DIR
*
d
cdef
struct_dirent
*
entry
cdef
string
entry_name
...
...
@@ -138,7 +138,7 @@ cdef cypclass FileNode(Node):
Node
.
__init__
(
self
,
path
,
name
,
st
)
self
.
error
=
False
void
build_node
(
self
,
lock
ed
cyplist
[
dev_t
]
dev_whitelist
,
locked
cyplist
[
string
]
ignore_paths
):
void
build_node
(
self
,
lock
cyplist
[
dev_t
]
dev_whitelist
,
lock
cyplist
[
string
]
ignore_paths
):
cdef
unsigned
char
buffer
[
BUFSIZE
]
cdef
bint
eof
=
False
cdef
bint
md5_ok
...
...
@@ -219,7 +219,7 @@ cdef cypclass SymlinkNode(Node):
string
target
int
error
void
build_node
(
self
,
lock
ed
cyplist
[
dev_t
]
dev_whitelist
,
locked
cyplist
[
string
]
ignore_paths
):
void
build_node
(
self
,
lock
cyplist
[
dev_t
]
dev_whitelist
,
lock
cyplist
[
string
]
ignore_paths
):
size
=
self
.
st
.
st_data
.
st_size
+
1
self
.
target
.
resize
(
size
)
real_size
=
readlink
(
self
.
path
.
c_str
(),
<
char
*>
self
.
target
.
data
(),
size
)
...
...
cython/runtime/runtime.pxd
View file @
ea6ba5dd
...
...
@@ -19,7 +19,7 @@ cdef cypclass Worker
# The 'inline' qualifier on this function is a hack to convince Cython to allow a definition in a .pxd file.
# The C compiler will dismiss it because we pass the function pointer to create a thread which prevents inlining.
cdef
inline
void
*
worker_function
(
void
*
arg
)
nogil
:
worker
=
<
lock
ed
Worker
>
arg
worker
=
<
lock
Worker
>
arg
sch
=
<
Scheduler
>
<
void
*>
worker
.
scheduler
cdef
int
num_remaining_queues
# Wait until all the workers are ready.
...
...
@@ -51,19 +51,19 @@ cdef inline void * worker_function(void * arg) nogil:
cdef
cypclass
Worker
:
deque
[
lock
ed
SequentialMailBox
]
queues
lock
ed
Scheduler
scheduler
deque
[
lock
SequentialMailBox
]
queues
lock
Scheduler
scheduler
pthread_t
thread
lock
ed
Worker
__new__
(
alloc
,
locked
Scheduler
scheduler
):
lock
Worker
__new__
(
alloc
,
lock
Scheduler
scheduler
):
instance
=
consume
alloc
()
instance
.
scheduler
=
scheduler
locked_instance
=
<
lock
ed
Worker
>
consume
instance
locked_instance
=
<
lock
Worker
>
consume
instance
if
not
pthread_create
(
&
locked_instance
.
thread
,
NULL
,
worker_function
,
<
void
*>
locked_instance
):
return
locked_instance
printf
(
"pthread_create() failed
\
n
"
)
lock
ed
SequentialMailBox
get_queue
(
locked
self
):
lock
SequentialMailBox
get_queue
(
lock
self
):
# Get the next queue in the worker's list or steal one.
with
wlocked
self
:
if
not
self
.
queues
.
empty
():
...
...
@@ -72,7 +72,7 @@ cdef cypclass Worker:
return
queue
return
self
.
steal_queue
()
lock
ed
SequentialMailBox
steal_queue
(
locked
self
):
lock
SequentialMailBox
steal_queue
(
lock
self
):
# Steal a queue from another worker:
# - inspect each worker in order starting at a random offset
# - skip this worker and any worker with an empty queue list
...
...
@@ -100,15 +100,15 @@ cdef cypclass Worker:
cdef
cypclass
Scheduler
:
vector
[
lock
ed
Worker
]
workers
vector
[
lock
Worker
]
workers
pthread_barrier_t
barrier
sem_t
num_free_queues
atomic
[
int
]
num_pending_queues
sem_t
done
volatile
bint
is_done
lock
ed
Scheduler
__new__
(
alloc
,
int
num_workers
=
0
):
self
=
<
lock
ed
Scheduler
>
consume
alloc
()
lock
Scheduler
__new__
(
alloc
,
int
num_workers
=
0
):
self
=
<
lock
Scheduler
>
consume
alloc
()
if
num_workers
==
0
:
num_workers
=
sysconf
(
_SC_NPROCESSORS_ONLN
)
sem_init
(
&
self
.
num_free_queues
,
0
,
0
)
sem_init
(
&
self
.
done
,
0
,
0
)
...
...
@@ -136,7 +136,7 @@ cdef cypclass Scheduler:
sem_destroy
(
&
self
.
num_free_queues
)
sem_destroy
(
&
self
.
done
)
void
post_queue
(
self
,
lock
ed
SequentialMailBox
queue
):
void
post_queue
(
self
,
lock
SequentialMailBox
queue
):
# Add a queue to the first worker.
main_worker
=
self
.
workers
[
0
]
with
wlocked
main_worker
:
...
...
@@ -147,7 +147,7 @@ cdef cypclass Scheduler:
# Signal that a queue is available.
sem_post
(
&
self
.
num_free_queues
)
void
finish
(
lock
ed
self
):
void
finish
(
lock
self
):
# Wait until there is no more work.
done
=
&
self
.
done
sem_wait
(
done
)
...
...
@@ -163,17 +163,17 @@ cdef cypclass Scheduler:
cdef
cypclass
SequentialMailBox
(
ActhonQueueInterface
):
deque
[
ActhonMessageInterface
]
messages
lock
ed
Scheduler
scheduler
lock
Scheduler
scheduler
bint
has_worker
__init__
(
self
,
lock
ed
Scheduler
scheduler
):
__init__
(
self
,
lock
Scheduler
scheduler
):
self
.
scheduler
=
scheduler
self
.
has_worker
=
False
bint
is_empty
(
const
self
):
return
self
.
messages
.
empty
()
void
push
(
locked
&
self
,
ActhonMessageInterface
message
):
void
push
(
locked
self
,
ActhonMessageInterface
message
):
# Add a task to the queue.
self
.
messages
.
push_back
(
message
)
if
message
.
_sync_method
is
not
NULL
:
...
...
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