Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
16
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
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
cellframe
cellframe-sdk
Commits
81b95e3d
Commit
81b95e3d
authored
4 years ago
by
dmitriy.gerasimov
Browse files
Options
Downloads
Plain Diff
Merge branch 'bugs-3618' into 'master'
bugs-3618 See merge request
libdap!42
parents
2b63f75d
c8379539
No related branches found
Branches containing commit
No related tags found
1 merge request
!24
Support 3689
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dap_common.c
+26
-20
26 additions, 20 deletions
src/dap_common.c
with
26 additions
and
20 deletions
src/dap_common.c
+
26
−
20
View file @
81b95e3d
...
@@ -271,7 +271,10 @@ int wdap_common_init( const char *a_console_title, const wchar_t *a_log_filename
...
@@ -271,7 +271,10 @@ int wdap_common_init( const char *a_console_title, const wchar_t *a_log_filename
* @brief dap_common_deinit Deinitialise
* @brief dap_common_deinit Deinitialise
*/
*/
void
dap_common_deinit
(
)
{
void
dap_common_deinit
(
)
{
pthread_mutex_lock
(
&
s_log_mutex
);
s_log_term_signal
=
true
;
s_log_term_signal
=
true
;
pthread_cond_signal
(
&
s_log_cond
);
pthread_mutex_unlock
(
&
s_log_mutex
);
pthread_join
(
s_log_thread
,
NULL
);
pthread_join
(
s_log_thread
,
NULL
);
if
(
s_log_file
)
if
(
s_log_file
)
fclose
(
s_log_file
);
fclose
(
s_log_file
);
...
@@ -289,29 +292,32 @@ static void *s_log_thread_proc(void *arg) {
...
@@ -289,29 +292,32 @@ static void *s_log_thread_proc(void *arg) {
pthread_mutex_lock
(
&
s_log_mutex
);
pthread_mutex_lock
(
&
s_log_mutex
);
for
(
;
s_log_count
==
0
;
)
{
for
(
;
s_log_count
==
0
;
)
{
pthread_cond_wait
(
&
s_log_cond
,
&
s_log_mutex
);
pthread_cond_wait
(
&
s_log_cond
,
&
s_log_mutex
);
}
if
(
s_log_term_signal
)
{
log_str_t
*
elem
,
*
tmp
;
break
;
if
(
s_log_file
)
{
if
(
!
dap_file_test
(
s_log_file_path
))
{
fclose
(
s_log_file
);
s_log_file
=
fopen
(
s_log_file_path
,
"a"
);
}
}
}
}
DL_FOREACH_SAFE
(
s_log_buffer
,
elem
,
tmp
)
{
if
(
s_log_count
)
{
if
(
s_log_file
)
log_str_t
*
elem
,
*
tmp
;
fwrite
(
elem
->
str
+
elem
->
offset
,
strlen
(
elem
->
str
)
-
elem
->
offset
,
1
,
s_log_file
);
if
(
s_log_file
)
{
fwrite
(
elem
->
str
,
strlen
(
elem
->
str
),
1
,
stdout
);
if
(
!
dap_file_test
(
s_log_file_path
))
{
fclose
(
s_log_file
);
DL_DELETE
(
s_log_buffer
,
elem
);
s_log_file
=
fopen
(
s_log_file_path
,
"a"
);
DAP_FREE
(
elem
);
}
--
s_log_count
;
}
DL_FOREACH_SAFE
(
s_log_buffer
,
elem
,
tmp
)
{
if
(
s_log_file
)
if
(
s_log_file
)
fflush
(
s_log_file
);
fwrite
(
elem
->
str
+
elem
->
offset
,
strlen
(
elem
->
str
)
-
elem
->
offset
,
1
,
s_log_file
);
fflush
(
stdout
);
fwrite
(
elem
->
str
,
strlen
(
elem
->
str
),
1
,
stdout
);
DL_DELETE
(
s_log_buffer
,
elem
);
DAP_FREE
(
elem
);
--
s_log_count
;
if
(
s_log_file
)
fflush
(
s_log_file
);
fflush
(
stdout
);
}
}
}
pthread_mutex_unlock
(
&
s_log_mutex
);
pthread_mutex_unlock
(
&
s_log_mutex
);
}
}
pthread_exit
(
NULL
);
pthread_exit
(
NULL
);
...
...
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