Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
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
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
Main
Synchronet
Commits
6d02d9f3
Commit
6d02d9f3
authored
21 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Switched from using an ODTimer for pascing od_kernel to using a signal
handler and setitimer()
parent
aa691df6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/odoors/ODKrnl.c
+31
-0
31 additions, 0 deletions
src/odoors/ODKrnl.c
src/odoors/ODKrnl.h
+4
-0
4 additions, 0 deletions
src/odoors/ODKrnl.h
src/odoors/ODPlat.c
+4
-1
4 additions, 1 deletion
src/odoors/ODPlat.c
with
39 additions
and
1 deletion
src/odoors/ODKrnl.c
+
31
−
0
View file @
6d02d9f3
...
...
@@ -107,6 +107,9 @@ static void ODKrnlHandleReceivedChar(char chReceived, BOOL bFromRemote);
static
void
ODKrnlTimeUpdate
(
void
);
static
void
ODKrnlChatCleanup
(
void
);
static
void
ODKrnlChatMode
(
void
);
#ifdef ODPLAT_NIX
void
sig_run_kernel
(
int
sig
);
#endif
/* Functions specific to the multithreaded implementation of the kernel. */
#ifdef OD_MULTITHREADED
...
...
@@ -170,6 +173,8 @@ tODResult ODKrnlInitialize(void)
{
#ifdef ODPLAT_NIX
sigset_t
block
;
struct
sigaction
act
;
struct
itimerval
itv
;
#endif
tODResult
Result
=
kODRCSuccess
;
...
...
@@ -179,6 +184,17 @@ tODResult ODKrnlInitialize(void)
sigemptyset
(
&
block
);
sigaddset
(
&
block
,
SIGHUP
);
sigprocmask
(
SIG_BLOCK
,
&
block
,
NULL
);
/* Run kernel on SIGALRM */
act
.
sa_handler
=
sig_run_kernel
;
act
.
sa_flags
=
0
;
sigemptyset
(
&
(
act
.
sa_mask
));
sigaction
(
SIGALRM
,
&
act
,
NULL
);
itv
.
it_interval
.
tv_sec
=
0
;
itv
.
it_interval
.
tv_usec
=
250000
;
itv
.
it_value
.
tv_sec
=
0
;
itv
.
it_value
.
tv_usec
=
250000
;
setitimer
(
ITIMER_REAL
,
&
itv
,
NULL
);
#endif
/* Initialize time of next status update and next time deduction. */
...
...
@@ -1573,3 +1589,18 @@ static void ODKrnlChatCleanup(void)
}
#endif
}
/* ----------------------------------------------------------------------------
* sig_run_kernel(sig) *** PRIVATE FUNCTION ***
*
* Runs od_kernel() on a SIGALRM
*
*/
#ifdef ODPLAT_NIX
void
sig_run_kernel
(
int
sig
)
{
od_kernel
();
}
#endif
This diff is collapsed.
Click to expand it.
src/odoors/ODKrnl.h
+
4
−
0
View file @
6d02d9f3
...
...
@@ -65,7 +65,11 @@ tODResult ODKrnlStartChatThread(BOOL bTriggeredInternally);
#ifdef OD_MULTITHREADED
#define CALL_KERNEL_IF_NEEDED()
#else
/* !OD_MULTITHREADED */
#ifdef ODPLAT_NIX
#define CALL_KERNEL_IF_NEEDED()
#else
#define CALL_KERNEL_IF_NEEDED() od_kernel()
#endif
/* !ODPLAT_NIX */
#endif
/* !OD_MULTITHREADED */
/* Macro used to increment or decrement OpenDoors active semaphore. */
...
...
This diff is collapsed.
Click to expand it.
src/odoors/ODPlat.c
+
4
−
1
View file @
6d02d9f3
...
...
@@ -615,11 +615,14 @@ BOOL ODTimerElapsed(tODTimer *pTimer)
#endif
/* ODPLAT_WIN32 */
#ifdef ODPLAT_NIX
/* Don't bother checking for RunKernelTimer */
if
(
pTimer
==&
RunKernelTimer
)
return
;
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
1000
;
gettimeofday
(
&
tv
,
NULL
);
end
.
tv_sec
=
pTimer
->
Start
.
tv_sec
+
(
pTimer
->
Duration
/
1000
);
end
.
tv_usec
=
(
pTimer
->
Start
.
tv_usec
+
(
pTimer
->
Duration
*
1000
))
%
1000000
;
gettimeofday
(
&
tv
,
NULL
);
return
(
end
.
tv_sec
>=
tv
.
tv_sec
&&
end
.
tv_usec
>=
tv
.
tv_usec
);
#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