[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-nim] branch master updated: make the cleanup proc t
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-nim] branch master updated: make the cleanup proc the finalizer (no explicit call necessary anymore) |
Date: |
Sun, 29 Jul 2018 19:30:21 +0200 |
This is an automated email from the git hooks/post-receive script.
lurchi pushed a commit to branch master
in repository gnunet-nim.
The following commit(s) were added to refs/heads/master by this push:
new 04b1430 make the cleanup proc the finalizer (no explicit call
necessary anymore)
04b1430 is described below
commit 04b14305521b88732e0f2bae637fbf242cdec94d
Author: lurchi <address@hidden>
AuthorDate: Sun Jul 29 19:29:49 2018 +0200
make the cleanup proc the finalizer (no explicit call necessary anymore)
---
gnunet_application.nim | 11 ++++++-----
gnunet_nim.nim | 5 ++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gnunet_application.nim b/gnunet_application.nim
index 5f0fa0b..d72069c 100644
--- a/gnunet_application.nim
+++ b/gnunet_application.nim
@@ -56,9 +56,14 @@ proc schedulerSetWakeup(cls: pointer,
debug("setting new timeout: ", dt.abs_value_us)
app.timeoutUs = dt.abs_value_us
+proc cleanup(app: ref GnunetApplication) =
+ echo "destroying GnunetApplication"
+ GNUNET_SCHEDULER_driver_done(app.schedulerHandle)
+ GNUNET_CONFIGURATION_destroy(app.configHandle)
+
proc initGnunetApplication*(configFile: string): ref GnunetApplication =
var app: ref GnunetApplication
- new(app)
+ new(app, cleanup)
app.timeoutUs = GNUNET_TIME_absolute_get_forever().abs_value_us
app.tasks = initTable[ptr GNUNET_SCHEDULER_Task, ptr
GNUNET_SCHEDULER_FdInfo]()
app.schedulerDriver = GNUNET_SCHEDULER_Driver(cls: addr app[],
@@ -71,10 +76,6 @@ proc initGnunetApplication*(configFile: string): ref
GnunetApplication =
assert(GNUNET_SYSERR != GNUNET_CONFIGURATION_load(app.configHandle,
configFile))
return app
-proc cleanup*(app: ref GnunetApplication) =
- GNUNET_SCHEDULER_driver_done(app.schedulerHandle)
- GNUNET_CONFIGURATION_destroy(app.configHandle)
-
proc doWork*(app: ref GnunetApplication) =
discard GNUNET_SCHEDULER_do_work(app.schedulerHandle) #FIXME: don't discard
diff --git a/gnunet_nim.nim b/gnunet_nim.nim
index b4c17b5..d141f85 100644
--- a/gnunet_nim.nim
+++ b/gnunet_nim.nim
@@ -18,8 +18,7 @@ proc main() =
poll(gnunetApp.millisecondsUntilTimeout())
gnunetApp.doWork()
except ValueError:
- discard
- gnunetApp.cleanup()
- echo "quitting"
+ echo "quitting"
main()
+GC_fullCollect()
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet-nim] branch master updated: make the cleanup proc the finalizer (no explicit call necessary anymore),
gnunet <=