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
20
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
f23c873f
Commit
f23c873f
authored
4 years ago
by
Roman Khlopkov
🔜
Browse files
Options
Downloads
Patches
Plain Diff
[+] Stub for interval timer for MacOS
parent
48f8246d
No related branches found
Branches containing commit
No related tags found
1 merge request
!43
features-3707
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dap-sdk/core/CMakeLists.txt
+1
-1
1 addition, 1 deletion
dap-sdk/core/CMakeLists.txt
dap-sdk/core/src/dap_common.c
+16
-7
16 additions, 7 deletions
dap-sdk/core/src/dap_common.c
with
17 additions
and
8 deletions
dap-sdk/core/CMakeLists.txt
+
1
−
1
View file @
f23c873f
...
...
@@ -100,7 +100,7 @@ endif()
if
(
ANDROID
)
add_subdirectory
(
src/android
)
target_link_libraries
(
${
PROJECT_NAME
}
dap_core_android
)
target_link_libraries
(
${
PROJECT_NAME
}
dap_core_android
rt
)
endif
()
if
(
WIN32
)
...
...
This diff is collapsed.
Click to expand it.
dap-sdk/core/src/dap_common.c
+
16
−
7
View file @
f23c873f
...
...
@@ -827,7 +827,7 @@ static int s_timer_find(void *a_timer)
static
void
CALLBACK
s_win_callback
(
PVOID
a_arg
,
BOOLEAN
a_always_true
)
{
UNUSED
(
a_always_true
);
s_timers
[(
in
t
)
a_arg
].
callback
(
s_timers
[(
in
t
)
a_arg
].
param
);
s_timers
[(
size_
t
)
a_arg
].
callback
(
s_timers
[(
size_
t
)
a_arg
].
param
);
}
#else
static
void
s_posix_callback
(
union
sigval
a_arg
)
...
...
@@ -847,16 +847,16 @@ void *dap_interval_timer_create(unsigned int a_msec, dap_timer_callback_t a_call
if
(
s_timers_count
==
DAP_INTERVAL_TIMERS_MAX
)
{
return
NULL
;
}
#ifdef
_
WIN32
#ifdef WIN32
if
(
s_timers_count
==
0
)
{
InitializeCriticalSection
(
&
s_timers_lock
);
}
HANDLE
l_timer
;
if
(
!
CreateTimerQueueTimer
(
&
l_timer
,
NULL
,
(
WAITORTIMERCALLBACK
)
s_win_callback
,
(
PVOID
)
s_timers_count
,
a_msec
,
a_msec
,
0
))
{
if
(
!
CreateTimerQueueTimer
(
&
l_timer
,
NULL
,
(
WAITORTIMERCALLBACK
)
s_win_callback
,
(
PVOID
)
(
size_t
)
s_timers_count
,
a_msec
,
a_msec
,
0
))
{
return
NULL
;
}
EnterCriticalSection
(
&
s_timers_lock
);
#el
se
#el
if DAP_OS_UNIX
if
(
s_timers_count
==
0
)
{
pthread_mutex_init
(
&
s_timers_lock
,
NULL
);
}
...
...
@@ -873,6 +873,8 @@ void *dap_interval_timer_create(unsigned int a_msec, dap_timer_callback_t a_call
l_period
.
it_interval
.
tv_nsec
=
l_period
.
it_value
.
tv_nsec
=
(
a_msec
%
1000
)
*
1000000
;
timer_settime
(
l_timer
,
0
,
&
l_period
,
NULL
);
pthread_mutex_lock
(
&
s_timers_lock
);
#esle
//DARWIN
#endif
s_timers
[
s_timers_count
].
timer
=
(
void
*
)
l_timer
;
s_timers
[
s_timers_count
].
callback
=
a_callback
;
...
...
@@ -880,8 +882,10 @@ void *dap_interval_timer_create(unsigned int a_msec, dap_timer_callback_t a_call
s_timers_count
++
;
#ifdef _WIN32
LeaveCriticalSection
(
&
s_timers_lock
);
#el
se
#el
if DAP_OS_UNIX
pthread_mutex_unlock
(
&
s_timers_lock
);
#else
//DARWIN
#endif
return
(
void
*
)
l_timer
;
}
...
...
@@ -898,8 +902,10 @@ int dap_interval_timer_delete(void *a_timer)
}
#ifdef _WIN32
EnterCriticalSection
(
&
s_timers_lock
);
#el
se
#el
if DAP_OS_UNIX
pthread_mutex_lock
(
&
s_timers_lock
);
#else
//DARWIN
#endif
int
l_timer_idx
=
s_timer_find
(
a_timer
);
if
(
l_timer_idx
==
-
1
)
{
...
...
@@ -915,10 +921,13 @@ int dap_interval_timer_delete(void *a_timer)
DeleteCriticalSection
(
&
s_timers_lock
);
}
return
!
DeleteTimerQueueTimer
(
NULL
,
(
HANDLE
)
a_timer
,
NULL
);
#else
#elif DAP_OS_UNIX
pthread_mutex_unlock
(
&
s_timers_lock
);
if
(
s_timers_count
==
0
)
{
pthread_mutex_destroy
(
&
s_timers_lock
);
}
return
timer_delete
((
timer_t
)
a_timer
);
#else
//DARWIN
#endif
}
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