added: Export plugin (not finished yet)
added: ThreadManager
all threads are connected to the ThreadManager
they are started/stopped by the manager
changed: FunctionParser
now we are parsing directly what is in URI
(we were using GetParser beforehand)
we are able to recognize ordinary URI scheme (with '?' and '#' characters)
sample:
http://domain.com/dir1/dir2/item/function?par1=val2&par2=val2#htmlanchor
is the same as:
http://domain.com/dir1/dir2/item/function/par1:val2/par2:val2#htmlanchor
'htmlanchor' is put in Request::anchor field,
and the default function can be used like this:
http://domain.com/dir1/dir2/item?par1=val2&par2=val2#htmlanchor
but there is not an equivalent in winix form
e.g. http://domain.com/dir1/dir2/item/par1:val2/par2:val2#htmlanchor
because 'par1:val2' would be treated as a function name
removed: GetParser
now we don't have Request::get_tab structure
removed: CKEditorGetParser
it is not needed now
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@752 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -19,11 +19,11 @@ app.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
||||
app.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
|
||||
app.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
|
||||
app.o: users.h groups.h group.h loadavg.h thumb.h basethread.h
|
||||
app.o: sessionmanager.h sessioncontainer.h ../functions/functions.h
|
||||
app.o: ../functions/functionbase.h ../core/request.h ../core/system.h
|
||||
app.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
|
||||
app.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
app.o: ../functions/privchanger.h ../functions/chown.h
|
||||
app.o: threadmanager.h sessionmanager.h sessioncontainer.h
|
||||
app.o: ../functions/functions.h ../functions/functionbase.h ../core/request.h
|
||||
app.o: ../core/system.h ../core/synchro.h ../functions/functionparser.h
|
||||
app.o: ../core/cur.h ../functions/adduser.h ../functions/cat.h
|
||||
app.o: ../functions/chmod.h ../functions/privchanger.h ../functions/chown.h
|
||||
app.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
|
||||
app.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
app.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
|
||||
@@ -35,16 +35,10 @@ app.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
app.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
app.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
|
||||
app.o: ../templates/templates.h ../templates/patterncacher.h
|
||||
app.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
app.o: ../core/log.h ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
app.o: compress.h getparser.h httpsimpleparser.h postparser.h cookieparser.h
|
||||
app.o: postmultiparser.h acceptencodingparser.h acceptbaseparser.h plugin.h
|
||||
app.o: pluginmsg.h
|
||||
basethread.o: basethread.h log.h textstream.h logmanipulators.h slog.h cur.h
|
||||
basethread.o: request.h requesttypes.h item.h error.h config.h confparser.h
|
||||
basethread.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
|
||||
basethread.o: misc.h session.h user.h plugindata.h rebus.h mount.h
|
||||
basethread.o: ../templates/locale.h ../core/confparser.h
|
||||
app.o: ../templates/indexpatterns.h ../core/sessionmanager.h compress.h
|
||||
app.o: postparser.h httpsimpleparser.h cookieparser.h postmultiparser.h
|
||||
app.o: acceptencodingparser.h acceptbaseparser.h plugin.h pluginmsg.h
|
||||
basethread.o: basethread.h
|
||||
bbcodeparser.o: bbcodeparser.h htmlfilter.h
|
||||
compress.o: compress.h log.h textstream.h logmanipulators.h slog.h cur.h
|
||||
compress.o: request.h requesttypes.h item.h error.h config.h confparser.h
|
||||
@@ -69,25 +63,25 @@ config.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
||||
config.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
||||
config.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
|
||||
config.o: mounts.h mountparser.h crypt.h run.h users.h groups.h group.h
|
||||
config.o: loadavg.h thumb.h basethread.h sessionmanager.h sessioncontainer.h
|
||||
config.o: ../functions/functions.h ../functions/functionbase.h
|
||||
config.o: ../core/request.h ../core/system.h ../core/synchro.h
|
||||
config.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
|
||||
config.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
||||
config.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
|
||||
config.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
|
||||
config.o: ../functions/last.h ../functions/login.h ../functions/logout.h
|
||||
config.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
|
||||
config.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
|
||||
config.o: ../functions/passwd.h ../functions/priv.h ../functions/reload.h
|
||||
config.o: ../functions/rm.h ../functions/specialdefault.h ../functions/stat.h
|
||||
config.o: loadavg.h thumb.h basethread.h threadmanager.h sessionmanager.h
|
||||
config.o: sessioncontainer.h ../functions/functions.h
|
||||
config.o: ../functions/functionbase.h ../core/request.h ../core/system.h
|
||||
config.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
|
||||
config.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
config.o: ../functions/privchanger.h ../functions/chown.h
|
||||
config.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
|
||||
config.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
config.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
|
||||
config.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
config.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
config.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
config.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
config.o: ../functions/subject.h ../functions/template.h
|
||||
config.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
config.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
config.o: ../core/htmlfilter.h ../templates/templates.h
|
||||
config.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
|
||||
config.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
config.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
config.o: ../templates/patterncacher.h ../templates/indexpatterns.h
|
||||
config.o: ../core/sessionmanager.h
|
||||
confparser.o: confparser.h misc.h item.h requesttypes.h ../../ezc/src/utf8.h
|
||||
crypt.o: crypt.h run.h config.h confparser.h htmlfilter.h user.h
|
||||
crypt.o: ../../ezc/src/utf8.h misc.h item.h requesttypes.h log.h textstream.h
|
||||
@@ -153,14 +147,13 @@ misc.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
|
||||
misc.o: ../../ezc/src/pattern.h ../../ezc/src/functions.h
|
||||
misc.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
||||
misc.o: ../templates/patterncacher.h ../core/item.h
|
||||
misc.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
misc.o: ../core/log.h ../templates/indexpatterns.h
|
||||
misc.o: ../templates/localefilter.h ../templates/locale.h ../core/config.h
|
||||
misc.o: ../templates/htmltextstream.h ../core/cur.h ../core/system.h
|
||||
misc.o: ../core/sessionmanager.h ../core/htmlfilter.h ../db/db.h
|
||||
misc.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
|
||||
misc.o: ../db/dbitemquery.h ../db/dbitemcolumns.h ../core/user.h
|
||||
misc.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
misc.o: ../templates/indexpatterns.h ../templates/localefilter.h
|
||||
misc.o: ../templates/locale.h ../core/config.h ../templates/htmltextstream.h
|
||||
misc.o: ../core/cur.h ../core/system.h ../core/sessionmanager.h
|
||||
misc.o: ../core/htmlfilter.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
|
||||
misc.o: ../db/dbtextstream.h ../core/error.h ../db/dbitemquery.h
|
||||
misc.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
|
||||
misc.o: ../core/dircontainer.h ../core/ugcontainer.h
|
||||
mount.o: mount.h misc.h item.h requesttypes.h
|
||||
mountparser.o: mountparser.h mount.h item.h dirs.h dircontainer.h ../db/db.h
|
||||
mountparser.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
|
||||
@@ -198,8 +191,8 @@ mounts.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
||||
mounts.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
||||
mounts.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
|
||||
mounts.o: mountparser.h plugin.h pluginmsg.h system.h crypt.h run.h users.h
|
||||
mounts.o: groups.h group.h loadavg.h thumb.h basethread.h sessionmanager.h
|
||||
mounts.o: sessioncontainer.h ../functions/functions.h
|
||||
mounts.o: groups.h group.h loadavg.h thumb.h basethread.h threadmanager.h
|
||||
mounts.o: sessionmanager.h sessioncontainer.h ../functions/functions.h
|
||||
mounts.o: ../functions/functionbase.h ../core/request.h ../core/system.h
|
||||
mounts.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
|
||||
mounts.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
@@ -215,9 +208,8 @@ mounts.o: ../functions/subject.h ../functions/template.h
|
||||
mounts.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
mounts.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
mounts.o: ../core/htmlfilter.h ../templates/templates.h
|
||||
mounts.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
|
||||
mounts.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
mounts.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
mounts.o: ../templates/patterncacher.h ../templates/indexpatterns.h
|
||||
mounts.o: ../core/sessionmanager.h
|
||||
plugin.o: plugin.h pluginmsg.h log.h textstream.h logmanipulators.h slog.h
|
||||
plugin.o: cur.h request.h requesttypes.h item.h error.h config.h confparser.h
|
||||
plugin.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
|
||||
@@ -236,25 +228,25 @@ plugin.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
||||
plugin.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
||||
plugin.o: ../core/config.h ../core/users.h ugcontainer.h lastcontainer.h
|
||||
plugin.o: mounts.h mountparser.h crypt.h run.h users.h groups.h group.h
|
||||
plugin.o: loadavg.h thumb.h basethread.h sessionmanager.h sessioncontainer.h
|
||||
plugin.o: ../functions/functions.h ../functions/functionbase.h
|
||||
plugin.o: ../core/request.h ../core/system.h ../core/synchro.h
|
||||
plugin.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
|
||||
plugin.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
||||
plugin.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
|
||||
plugin.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
|
||||
plugin.o: ../functions/last.h ../functions/login.h ../functions/logout.h
|
||||
plugin.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
|
||||
plugin.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
|
||||
plugin.o: ../functions/passwd.h ../functions/priv.h ../functions/reload.h
|
||||
plugin.o: ../functions/rm.h ../functions/specialdefault.h ../functions/stat.h
|
||||
plugin.o: loadavg.h thumb.h basethread.h threadmanager.h sessionmanager.h
|
||||
plugin.o: sessioncontainer.h ../functions/functions.h
|
||||
plugin.o: ../functions/functionbase.h ../core/request.h ../core/system.h
|
||||
plugin.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
|
||||
plugin.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
plugin.o: ../functions/privchanger.h ../functions/chown.h
|
||||
plugin.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
|
||||
plugin.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
plugin.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
|
||||
plugin.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
plugin.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
plugin.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
plugin.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
plugin.o: ../functions/subject.h ../functions/template.h
|
||||
plugin.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
plugin.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
plugin.o: ../core/htmlfilter.h ../templates/templates.h
|
||||
plugin.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
|
||||
plugin.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
plugin.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
plugin.o: ../templates/patterncacher.h ../templates/indexpatterns.h
|
||||
plugin.o: ../core/sessionmanager.h
|
||||
plugindata.o: plugindata.h plugin.h pluginmsg.h log.h textstream.h
|
||||
plugindata.o: logmanipulators.h slog.h cur.h request.h requesttypes.h item.h
|
||||
plugindata.o: error.h config.h confparser.h htmlfilter.h
|
||||
@@ -275,9 +267,10 @@ plugindata.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
||||
plugindata.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
|
||||
plugindata.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h
|
||||
plugindata.o: run.h users.h groups.h group.h loadavg.h thumb.h basethread.h
|
||||
plugindata.o: sessionmanager.h sessioncontainer.h ../functions/functions.h
|
||||
plugindata.o: ../functions/functionbase.h ../core/request.h ../core/system.h
|
||||
plugindata.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
|
||||
plugindata.o: threadmanager.h sessionmanager.h sessioncontainer.h
|
||||
plugindata.o: ../functions/functions.h ../functions/functionbase.h
|
||||
plugindata.o: ../core/request.h ../core/system.h ../core/synchro.h
|
||||
plugindata.o: ../functions/functionparser.h ../core/cur.h
|
||||
plugindata.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
plugindata.o: ../functions/privchanger.h ../functions/chown.h
|
||||
plugindata.o: ../functions/ckeditor.h ../functions/cp.h
|
||||
@@ -293,9 +286,7 @@ plugindata.o: ../functions/tinymce.h ../functions/uname.h
|
||||
plugindata.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
|
||||
plugindata.o: ../functions/vim.h ../core/htmlfilter.h
|
||||
plugindata.o: ../templates/templates.h ../templates/patterncacher.h
|
||||
plugindata.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
plugindata.o: ../core/log.h ../templates/indexpatterns.h
|
||||
plugindata.o: ../core/sessionmanager.h
|
||||
plugindata.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
postmultiparser.o: postmultiparser.h error.h requesttypes.h config.h
|
||||
postmultiparser.o: confparser.h htmlfilter.h misc.h item.h log.h textstream.h
|
||||
postmultiparser.o: logmanipulators.h slog.h cur.h request.h
|
||||
@@ -327,25 +318,25 @@ request.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
||||
request.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
|
||||
request.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
|
||||
request.o: users.h groups.h group.h loadavg.h thumb.h basethread.h
|
||||
request.o: sessionmanager.h sessioncontainer.h ../functions/functions.h
|
||||
request.o: ../functions/functionbase.h ../core/request.h ../core/system.h
|
||||
request.o: ../core/synchro.h ../functions/functionparser.h ../core/cur.h
|
||||
request.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
request.o: ../functions/privchanger.h ../functions/chown.h
|
||||
request.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
|
||||
request.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
request.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
|
||||
request.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
request.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
request.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
request.o: threadmanager.h sessionmanager.h sessioncontainer.h
|
||||
request.o: ../functions/functions.h ../functions/functionbase.h
|
||||
request.o: ../core/request.h ../core/system.h ../core/synchro.h
|
||||
request.o: ../functions/functionparser.h ../core/cur.h ../functions/adduser.h
|
||||
request.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
|
||||
request.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
|
||||
request.o: ../functions/default.h ../functions/download.h
|
||||
request.o: ../functions/emacs.h ../functions/last.h ../functions/login.h
|
||||
request.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
|
||||
request.o: ../functions/mkdir.h ../functions/mv.h ../functions/nicedit.h
|
||||
request.o: ../functions/node.h ../functions/passwd.h ../functions/priv.h
|
||||
request.o: ../functions/reload.h ../functions/rm.h
|
||||
request.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
request.o: ../functions/subject.h ../functions/template.h
|
||||
request.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
request.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
request.o: ../core/htmlfilter.h ../templates/templates.h
|
||||
request.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
|
||||
request.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
request.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
request.o: ../templates/patterncacher.h ../templates/indexpatterns.h
|
||||
request.o: ../core/sessionmanager.h
|
||||
run.o: run.h log.h textstream.h logmanipulators.h slog.h cur.h request.h
|
||||
run.o: requesttypes.h item.h error.h config.h confparser.h htmlfilter.h
|
||||
run.o: ../templates/htmltextstream.h ../core/textstream.h misc.h session.h
|
||||
@@ -380,10 +371,10 @@ sessionmanager.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
||||
sessionmanager.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
||||
sessionmanager.o: ../core/config.h ../core/users.h ugcontainer.h mounts.h
|
||||
sessionmanager.o: mountparser.h crypt.h run.h users.h groups.h group.h
|
||||
sessionmanager.o: loadavg.h thumb.h basethread.h sessionparser.h plugin.h
|
||||
sessionmanager.o: pluginmsg.h ../functions/functions.h
|
||||
sessionmanager.o: ../functions/functionbase.h ../core/request.h
|
||||
sessionmanager.o: ../core/system.h ../core/synchro.h
|
||||
sessionmanager.o: loadavg.h thumb.h basethread.h threadmanager.h
|
||||
sessionmanager.o: sessionparser.h plugin.h pluginmsg.h
|
||||
sessionmanager.o: ../functions/functions.h ../functions/functionbase.h
|
||||
sessionmanager.o: ../core/request.h ../core/system.h ../core/synchro.h
|
||||
sessionmanager.o: ../functions/functionparser.h ../core/cur.h
|
||||
sessionmanager.o: ../functions/adduser.h ../functions/cat.h
|
||||
sessionmanager.o: ../functions/chmod.h ../functions/privchanger.h
|
||||
@@ -402,9 +393,7 @@ sessionmanager.o: ../functions/tinymce.h ../functions/uname.h
|
||||
sessionmanager.o: ../functions/upload.h ../functions/uptime.h
|
||||
sessionmanager.o: ../functions/who.h ../functions/vim.h ../core/htmlfilter.h
|
||||
sessionmanager.o: ../templates/templates.h ../templates/patterncacher.h
|
||||
sessionmanager.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
sessionmanager.o: ../core/log.h ../templates/indexpatterns.h
|
||||
sessionmanager.o: ../core/sessionmanager.h
|
||||
sessionmanager.o: ../templates/indexpatterns.h ../core/sessionmanager.h
|
||||
sessionparser.o: sessionparser.h session.h item.h error.h user.h plugindata.h
|
||||
sessionparser.o: rebus.h textstream.h sessioncontainer.h cur.h request.h
|
||||
sessionparser.o: requesttypes.h config.h confparser.h htmlfilter.h
|
||||
@@ -434,12 +423,32 @@ system.o: ../notify/notifythread.h ../core/basethread.h synchro.h
|
||||
system.o: ../notify/templatesnotify.h ../core/config.h ../core/users.h
|
||||
system.o: ugcontainer.h lastcontainer.h mounts.h mountparser.h crypt.h run.h
|
||||
system.o: users.h groups.h group.h loadavg.h thumb.h basethread.h
|
||||
system.o: ../templates/templates.h ../templates/patterncacher.h
|
||||
system.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
system.o: ../core/log.h ../templates/indexpatterns.h ../core/cur.h
|
||||
system.o: ../core/system.h ../core/sessionmanager.h ../core/htmlfilter.h
|
||||
system.o: ../functions/functionbase.h ../core/request.h ../core/synchro.h
|
||||
system.o: threadmanager.h ../templates/templates.h
|
||||
system.o: ../templates/patterncacher.h ../templates/indexpatterns.h
|
||||
system.o: ../core/cur.h ../core/system.h ../core/sessionmanager.h
|
||||
system.o: ../core/htmlfilter.h ../functions/functionbase.h ../core/request.h
|
||||
system.o: ../core/synchro.h plugin.h pluginmsg.h sessionmanager.h
|
||||
system.o: sessioncontainer.h ../functions/functions.h
|
||||
system.o: ../functions/functionbase.h ../functions/functionparser.h
|
||||
system.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
system.o: ../functions/privchanger.h ../functions/chown.h
|
||||
system.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
|
||||
system.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
system.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
|
||||
system.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
system.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
system.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
system.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
system.o: ../functions/subject.h ../functions/template.h
|
||||
system.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
system.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
textstream.o: textstream.h misc.h item.h requesttypes.h
|
||||
threadmanager.o: threadmanager.h basethread.h synchro.h log.h textstream.h
|
||||
threadmanager.o: logmanipulators.h slog.h cur.h request.h requesttypes.h
|
||||
threadmanager.o: item.h error.h config.h confparser.h htmlfilter.h
|
||||
threadmanager.o: ../templates/htmltextstream.h ../core/textstream.h misc.h
|
||||
threadmanager.o: session.h user.h plugindata.h rebus.h mount.h
|
||||
threadmanager.o: ../templates/locale.h ../core/confparser.h
|
||||
thumb.o: thumb.h basethread.h textstream.h ../db/db.h ../db/dbbase.h
|
||||
thumb.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
|
||||
thumb.o: item.h requesttypes.h ../core/error.h ../db/dbitemquery.h
|
||||
@@ -457,5 +466,5 @@ thumb.o: ../../ezc/src/funinfo.h ../../ezc/src/stringconv.h
|
||||
thumb.o: ../templates/htmltextstream.h ../notify/notifythread.h
|
||||
thumb.o: ../core/basethread.h synchro.h ../notify/templatesnotify.h
|
||||
thumb.o: ../core/users.h ugcontainer.h lastcontainer.h mounts.h mountparser.h
|
||||
thumb.o: crypt.h run.h users.h groups.h group.h loadavg.h
|
||||
thumb.o: crypt.h run.h users.h groups.h group.h loadavg.h threadmanager.h
|
||||
users.o: users.h
|
||||
|
||||
@@ -1 +1 @@
|
||||
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o confparser.o crypt.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o item.o lastcontainer.o loadavg.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionmanager.o sessionparser.o slog.o synchro.o system.o textstream.o thumb.o users.o
|
||||
o = acceptbaseparser.o app.o basethread.o bbcodeparser.o compress.o config.o confparser.o crypt.o dircontainer.o dirs.o groups.o htmlfilter.o httpsimpleparser.o item.o lastcontainer.o loadavg.o log.o misc.o mount.o mountparser.o mounts.o plugin.o plugindata.o postmultiparser.o rebus.o request.o run.o session.o sessioncontainer.o sessionmanager.o sessionparser.o slog.o synchro.o system.o textstream.o threadmanager.o thumb.o users.o
|
||||
|
||||
40
core/app.cpp
40
core/app.cpp
@@ -152,7 +152,6 @@ bool App::Init()
|
||||
|
||||
CreateStaticTree();
|
||||
|
||||
get_parser.UTF8(config.utf8);
|
||||
post_parser.UTF8(config.utf8);
|
||||
post_parser.LogValueSize(config.log_post_value_size);
|
||||
// post_multi_parser has a pointer to the config
|
||||
@@ -184,6 +183,8 @@ bool App::BaseUrlRedirect()
|
||||
|
||||
cur.request->redirect_to = config.base_url;
|
||||
AssignString(cur.request->env_request_uri, cur.request->redirect_to, false);
|
||||
// cur.request->env_request_uri should not be UrlEncoded
|
||||
cur.request->redirect_url_encoded = true;
|
||||
|
||||
log << log3 << "RC: BaseUrlRedirect from: " << cur.request->env_http_host << logend;
|
||||
|
||||
@@ -372,7 +373,6 @@ void App::Make()
|
||||
{
|
||||
// !! dodac inne informacje (get, post, itp)
|
||||
// jesli jest debug_info wlaczone to nie robic przekierowan
|
||||
cur.request->PrintGetTab();
|
||||
//cur.request->PrintEnv(); // !! PrintEnv() mozna przeniesc tutaj (do klasy App)
|
||||
}
|
||||
}
|
||||
@@ -476,7 +476,7 @@ void App::LogAccess()
|
||||
void App::ReadGetPostVars()
|
||||
{
|
||||
// get parameters we have always
|
||||
get_parser.Parse(cur.request->env_request_uri, cur.request->get_tab);
|
||||
//get_parser.Parse(cur.request->env_request_uri, cur.request->get_tab);
|
||||
|
||||
if( cur.request->method == Request::post )
|
||||
{
|
||||
@@ -621,7 +621,11 @@ void App::SendHeadersRedirect()
|
||||
break;
|
||||
}
|
||||
|
||||
UrlEncode(cur.request->redirect_to, cur.request->aredirect_to);
|
||||
if( !cur.request->redirect_url_encoded )
|
||||
UrlEncode(cur.request->redirect_to, cur.request->aredirect_to);
|
||||
else
|
||||
Ezc::WideToUTF8(cur.request->redirect_to, cur.request->aredirect_to);
|
||||
|
||||
FCGX_FPrintF(fcgi_request.out, "Location: %s\r\n", cur.request->aredirect_to.c_str());
|
||||
log << log2 << "Redirect to: " << cur.request->aredirect_to << logend;
|
||||
}
|
||||
@@ -1127,9 +1131,7 @@ void App::WaitForThreads()
|
||||
// but it doesn't matter, don't use pthread_join on it
|
||||
//pthread_join(signal_thread, 0);
|
||||
|
||||
system.notify.WaitForThread();
|
||||
session_manager.WaitForThread();
|
||||
system.thumb.WaitForThread();
|
||||
system.thread_manager.StopAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -1163,9 +1165,6 @@ sigset_t set;
|
||||
app->synchro.was_stop_signal = true;
|
||||
FCGX_ShutdownPending();
|
||||
Ezc::WideToUTF8(app->config.base_url, app->url_to_fetch_on_exit);
|
||||
app->system.notify.PrepareToStopThread();
|
||||
app->session_manager.WakeUpThread();
|
||||
app->system.thumb.WakeUpThread();
|
||||
app->Unlock();
|
||||
|
||||
// this thread will hang on this method
|
||||
@@ -1180,27 +1179,14 @@ sigset_t set;
|
||||
|
||||
void App::StartThreads()
|
||||
{
|
||||
sigset_t set;
|
||||
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGTERM);
|
||||
sigaddset(&set, SIGINT);
|
||||
|
||||
// blocking SIGTERM and SIGINT
|
||||
// new threads will have the signals blocked too
|
||||
pthread_sigmask(SIG_BLOCK, &set, 0);
|
||||
// make sure system.thread_manager.Init() was called beforehand
|
||||
// it is called in Init() -> system.Init()
|
||||
|
||||
// special thread only for signals
|
||||
pthread_create(&signal_thread, 0, SpecialThreadForSignals, this);
|
||||
|
||||
// thread for notifications
|
||||
system.notify.StartThread();
|
||||
|
||||
// gc for sessions
|
||||
session_manager.StartThread();
|
||||
|
||||
// thumbnails
|
||||
system.thumb.StartThread();
|
||||
system.thread_manager.Add(&session_manager);
|
||||
system.thread_manager.StartAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "functions/functions.h"
|
||||
#include "templates/templates.h"
|
||||
#include "compress.h"
|
||||
#include "getparser.h"
|
||||
#include "postparser.h"
|
||||
#include "cookieparser.h"
|
||||
#include "postmultiparser.h"
|
||||
@@ -38,7 +37,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
class App
|
||||
{
|
||||
public:
|
||||
@@ -109,11 +107,10 @@ private:
|
||||
h_403
|
||||
};
|
||||
|
||||
GetParser get_parser;
|
||||
PostParser post_parser;
|
||||
PostMultiParser post_multi_parser;
|
||||
CookieParser cookie_parser;
|
||||
AcceptEncodingParser accept_encoding_parser;
|
||||
AcceptEncodingParser accept_encoding_parser;
|
||||
Compress compress;
|
||||
std::wstring clean_html, html_with_debug;
|
||||
FCGX_Request fcgi_request;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "basethread.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
|
||||
BaseThread::BaseThread() : thread_signal(PTHREAD_COND_INITIALIZER)
|
||||
@@ -21,6 +21,7 @@ BaseThread::BaseThread() : thread_signal(PTHREAD_COND_INITIALIZER)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BaseThread::SetSynchro(Synchro * psynchro)
|
||||
{
|
||||
synchro = psynchro;
|
||||
@@ -34,6 +35,12 @@ void BaseThread::Mode(int mode)
|
||||
}
|
||||
|
||||
|
||||
pthread_t BaseThread::ThreadId()
|
||||
{
|
||||
return thread_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool BaseThread::Lock()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -63,6 +63,11 @@ public:
|
||||
// it's called only if Init() returned true
|
||||
virtual void Uninit() {}
|
||||
|
||||
// returns the thread id
|
||||
// this identifier is set by StartThread() metdhod
|
||||
pthread_t ThreadId();
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -68,8 +68,9 @@
|
||||
|
||||
//#define WINIX_ERR_UNKNOWN 1000
|
||||
#define WINIX_NOTHING_TO_DO 109
|
||||
#define WINIX_ERR_INCORRECT_URI 110
|
||||
|
||||
|
||||
#define WINIX_ERR_INTERNAL_ERROR 2000
|
||||
|
||||
|
||||
typedef int Error;
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_core_getparser
|
||||
#define headerfile_winix_core_getparser
|
||||
|
||||
#include "httpsimpleparser.h"
|
||||
#include "requesttypes.h"
|
||||
#include "misc.h"
|
||||
#include "utf8.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
class GetParser : public HttpSimpleParser
|
||||
{
|
||||
|
||||
const char * get_string;
|
||||
GetTab * get_tab;
|
||||
std::wstring temp;
|
||||
bool input_as_utf8;
|
||||
|
||||
protected:
|
||||
|
||||
virtual int GetChar()
|
||||
{
|
||||
if( !get_string || *get_string == 0 )
|
||||
return -1;
|
||||
|
||||
return (int)(unsigned char)*(get_string++);
|
||||
}
|
||||
|
||||
|
||||
virtual void Parameter(std::string &, std::string & value)
|
||||
{
|
||||
if( input_as_utf8 )
|
||||
Ezc::UTF8ToWide(value, temp);
|
||||
else
|
||||
AssignString(value, temp);
|
||||
|
||||
get_tab->push_back(temp);
|
||||
log << log2 << "Get, value: \"" << temp << "\"" << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
GetParser()
|
||||
{
|
||||
HttpSimpleParser::separator = '/';
|
||||
HttpSimpleParser::read_name = false;
|
||||
input_as_utf8 = false;
|
||||
}
|
||||
|
||||
|
||||
void UTF8(bool utf)
|
||||
{
|
||||
input_as_utf8 = utf;
|
||||
}
|
||||
|
||||
|
||||
// get_string_ can be null
|
||||
void Parse(const char * get_string_, GetTab & get_tab_)
|
||||
{
|
||||
get_string = get_string_;
|
||||
get_tab = &get_tab_;
|
||||
|
||||
if( get_string && *get_string == separator )
|
||||
{
|
||||
// skipping one '/' at the beginning
|
||||
++get_string;
|
||||
}
|
||||
|
||||
HttpSimpleParser::Parse();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -16,7 +16,8 @@
|
||||
#define WINIX_ITEM_FILETYPE_NONE 0
|
||||
#define WINIX_ITEM_FILETYPE_IMAGE 1
|
||||
#define WINIX_ITEM_FILETYPE_DOCUMENT 2
|
||||
#define WINIX_ITEM_FILETYPE_UNKNOWN 3
|
||||
#define WINIX_ITEM_FILETYPE_VIDEO 3
|
||||
#define WINIX_ITEM_FILETYPE_UNKNOWN 10
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -923,6 +923,15 @@ int SelectFileType(const wchar_t * file_name)
|
||||
EqualNoCase(ext, L"odt") )
|
||||
return WINIX_ITEM_FILETYPE_DOCUMENT;
|
||||
|
||||
if( EqualNoCase(ext, L"avi") ||
|
||||
EqualNoCase(ext, L"mp4") ||
|
||||
EqualNoCase(ext, L"flv") ||
|
||||
EqualNoCase(ext, L"mpg") ||
|
||||
EqualNoCase(ext, L"mpeg") ||
|
||||
EqualNoCase(ext, L"mkv") ||
|
||||
EqualNoCase(ext, L"wmv") )
|
||||
return WINIX_ITEM_FILETYPE_VIDEO;
|
||||
|
||||
return WINIX_ITEM_FILETYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -987,6 +996,7 @@ char buffer[10];
|
||||
if( clear_out )
|
||||
out.clear();
|
||||
|
||||
// !! we should not use such characters here: '/' '#'
|
||||
for(size_t i=0 ; i<in.size() ; ++i)
|
||||
{
|
||||
if( (in[i] >= 'a' && in[i] <= 'z') ||
|
||||
@@ -1003,7 +1013,7 @@ char buffer[10];
|
||||
out += '%';
|
||||
|
||||
if( buffer[1] == 0 )
|
||||
out += '0'; // there is only one characters in the buffer
|
||||
out += '0'; // there is only one character in the buffer
|
||||
|
||||
out += buffer;
|
||||
}
|
||||
|
||||
@@ -93,11 +93,21 @@
|
||||
// with a template file name
|
||||
#define WINIX_NOTIFY_ADD_TEMPLATE 3013
|
||||
|
||||
|
||||
// the request is ended
|
||||
// the request is being ended
|
||||
// you can clear some of your object here
|
||||
#define WINIX_END_REQUEST 3014
|
||||
|
||||
// a new file (page) has been added
|
||||
// in p1 you have a pointer to the Item struct
|
||||
#define WINIX_FILE_ADDED 3015
|
||||
|
||||
// a file (page) has been changed (edited)
|
||||
// in p1 you have a pointer to the Item struct
|
||||
#define WINIX_FILE_CHANGED 3016
|
||||
|
||||
|
||||
|
||||
|
||||
// values from 4000 - 4099 reserved for 'thread' plugin
|
||||
// see plugins/thread/pluginmsg.h
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ void Request::Clear()
|
||||
|
||||
RemovePostFileTmp(post_file_tab);
|
||||
|
||||
get_tab.clear();
|
||||
post_tab.clear();
|
||||
post_file_tab.clear();
|
||||
cookie_tab.clear();
|
||||
@@ -72,11 +71,13 @@ void Request::Clear()
|
||||
is_item = false;
|
||||
function = 0; // !! dodac jakas empty funkcje
|
||||
param_tab.clear();
|
||||
anchor.clear();
|
||||
|
||||
status = WINIX_ERR_OK;
|
||||
|
||||
browser_msie = false;
|
||||
redirect_to.clear();
|
||||
redirect_url_encoded = false;
|
||||
redirect_type = 303;
|
||||
x_sendfile.clear();
|
||||
send_as_attachment = false;
|
||||
@@ -169,15 +170,6 @@ return &p->second;
|
||||
|
||||
|
||||
|
||||
void Request::PrintGetTab()
|
||||
{
|
||||
debug << "get_tab: " << get_tab.size() << "\n";
|
||||
|
||||
for(GetTab::iterator i = get_tab.begin() ; i != get_tab.end() ; ++i)
|
||||
debug << " \"" << *i << "\"\n";
|
||||
|
||||
debug << '\n';
|
||||
}
|
||||
|
||||
/*
|
||||
void Request::PrintEnv()
|
||||
|
||||
@@ -52,11 +52,13 @@ struct Request
|
||||
bool use_html_filter;
|
||||
|
||||
// raw parameters
|
||||
GetTab get_tab;
|
||||
PostTab post_tab;
|
||||
PostFileTab post_file_tab;
|
||||
CookieTab cookie_tab;
|
||||
|
||||
// html anchor (those part of URI after '#' character)
|
||||
std::wstring anchor;
|
||||
|
||||
// environment variables
|
||||
// they are not null -- when the server doesn't have such a variable
|
||||
// it will be pointing into 'char_empty' which is default '\0'
|
||||
@@ -102,6 +104,10 @@ struct Request
|
||||
std::wstring redirect_to;
|
||||
std::string aredirect_to;
|
||||
|
||||
// if false then we should use url encode on 'redirect_to' before sending the header
|
||||
// default: false
|
||||
bool redirect_url_encoded;
|
||||
|
||||
// a redirect type
|
||||
// following redirect types are supported:
|
||||
// 300 Multiple Choices
|
||||
@@ -126,7 +132,6 @@ struct Request
|
||||
void Clear();
|
||||
|
||||
// for debugging
|
||||
void PrintGetTab();
|
||||
//void PrintEnv();
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ struct Param
|
||||
|
||||
|
||||
// some global types used by Request class
|
||||
typedef std::vector<std::wstring> GetTab;
|
||||
typedef std::map<std::wstring, std::wstring> PostTab;
|
||||
typedef std::map<std::wstring, PostFile> PostFileTab;
|
||||
typedef std::vector<Param> ParamTab;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "error.h"
|
||||
#include "templates/templates.h"
|
||||
#include "functions/functionbase.h"
|
||||
#include "plugin.h"
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +44,9 @@ void System::SetSynchro(Synchro * psynchro)
|
||||
|
||||
void System::Init()
|
||||
{
|
||||
thread_manager.SetSynchro(synchro);
|
||||
thread_manager.Init();
|
||||
|
||||
dirs.SetDb(db);
|
||||
dirs.SetCur(cur);
|
||||
dirs.SetNotify(¬ify);
|
||||
@@ -68,12 +72,15 @@ void System::Init()
|
||||
notify.SetConfig(config);
|
||||
notify.SetUsers(&users);
|
||||
notify.SetDirs(&dirs);
|
||||
notify.SetThreadManager(&thread_manager);
|
||||
notify.Init();
|
||||
|
||||
|
||||
thumb.SetSynchro(synchro);
|
||||
thumb.SetDb(db);
|
||||
thumb.SetConfig(config);
|
||||
thumb.SetSystem(this);
|
||||
thread_manager.Add(&thumb);
|
||||
|
||||
crypt.SetConfig(config);
|
||||
}
|
||||
@@ -632,6 +639,8 @@ Error System::AddFile(Item & item, int notify_code)
|
||||
|
||||
if( notify_code )
|
||||
notify.ItemChanged(notify_code, item);
|
||||
|
||||
plugin.Call(WINIX_FILE_ADDED, &item);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -661,6 +670,8 @@ Error System::EditFile(Item & item, bool with_url, int notify_code)
|
||||
|
||||
if( notify_code )
|
||||
notify.ItemChanged(notify_code, item);
|
||||
|
||||
plugin.Call(WINIX_FILE_CHANGED, &item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "loadavg.h"
|
||||
#include "synchro.h"
|
||||
#include "thumb.h"
|
||||
#include "threadmanager.h"
|
||||
#include "notify/notify.h"
|
||||
|
||||
|
||||
@@ -63,6 +64,9 @@ public:
|
||||
// cryptography and hashes
|
||||
Crypt crypt;
|
||||
|
||||
// thread management
|
||||
ThreadManager thread_manager;
|
||||
|
||||
void SetCur(Cur * pcur);
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetDb(Db * pdb);
|
||||
|
||||
104
core/threadmanager.cpp
Executable file
104
core/threadmanager.cpp
Executable file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include "threadmanager.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
ThreadManager::ThreadManager()
|
||||
{
|
||||
were_started = false;
|
||||
}
|
||||
|
||||
|
||||
void ThreadManager::SetSynchro(Synchro * psynchro)
|
||||
{
|
||||
synchro = psynchro;
|
||||
}
|
||||
|
||||
|
||||
void ThreadManager::Init()
|
||||
{
|
||||
sigset_t set;
|
||||
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGTERM);
|
||||
sigaddset(&set, SIGINT);
|
||||
|
||||
// blocking SIGTERM and SIGINT
|
||||
// new threads will have the signals blocked too
|
||||
pthread_sigmask(SIG_BLOCK, &set, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ThreadManager::Add(BaseThread * pbase)
|
||||
{
|
||||
thread_tab.push_back(pbase);
|
||||
|
||||
if( were_started )
|
||||
Start(thread_tab.size() - 1);
|
||||
else
|
||||
log << log4 << "TM: added a thread to the queue, number: " << (thread_tab.size()-1) << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ThreadManager::StartAll()
|
||||
{
|
||||
for(size_t i=0 ; i<thread_tab.size() ; ++i)
|
||||
Start(i);
|
||||
|
||||
were_started = true;
|
||||
}
|
||||
|
||||
|
||||
void ThreadManager::Start(size_t i)
|
||||
{
|
||||
if( i < thread_tab.size() )
|
||||
{
|
||||
if( thread_tab[i]->StartThread() )
|
||||
{
|
||||
log << log4 << "TM: thread " << i << " (" << thread_tab[i]->ThreadId() << ") started" << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log4 << "TM: cannot run a thread, thread number: " << i << logend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ThreadManager::StopAll()
|
||||
{
|
||||
if( !were_started )
|
||||
return;
|
||||
|
||||
// WakeUpThread() should be used with Lock/Unlock
|
||||
synchro->Lock();
|
||||
|
||||
for(size_t i=0 ; i<thread_tab.size() ; ++i)
|
||||
thread_tab[i]->WakeUpThread();
|
||||
|
||||
synchro->Unlock();
|
||||
|
||||
|
||||
for(size_t i=0 ; i<thread_tab.size() ; ++i)
|
||||
{
|
||||
log << log4 << "TM: waiting for thread " << i << " (" << thread_tab[i]->ThreadId() << ")" << logend;
|
||||
thread_tab[i]->WaitForThread();
|
||||
log << log4 << "TM: thread " << i << " terminated" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
55
core/threadmanager.h
Executable file
55
core/threadmanager.h
Executable file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_core_threadmanager
|
||||
#define headerfile_winix_core_threadmanager
|
||||
|
||||
#include <vector>
|
||||
#include "basethread.h"
|
||||
#include "synchro.h"
|
||||
|
||||
|
||||
|
||||
class ThreadManager
|
||||
{
|
||||
public:
|
||||
|
||||
ThreadManager();
|
||||
|
||||
// synchro object
|
||||
void SetSynchro(Synchro * psynchro);
|
||||
|
||||
// initializing
|
||||
void Init();
|
||||
|
||||
// adding a new thread to the queue
|
||||
// the thread will be running only if we call StartAll() before
|
||||
// otherwise the thread will be waiting for StartAll()
|
||||
void Add(BaseThread * pbase);
|
||||
|
||||
// starting all threads
|
||||
void StartAll();
|
||||
|
||||
// sending a stop signal to all threads
|
||||
// and waiting until they finish
|
||||
void StopAll();
|
||||
|
||||
private:
|
||||
|
||||
Synchro * synchro;
|
||||
typedef std::vector<BaseThread*> ThreadTab;
|
||||
ThreadTab thread_tab;
|
||||
bool were_started;
|
||||
|
||||
void Start(size_t i);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user