Commit Graph

7 Commits

Author SHA1 Message Date
Alexey Sokolov
9c48119897 Use C++11 threads instead of custom pthread wrappers.
Signal handling of CThread was handled in previous commit.
2015-12-06 00:11:15 +00:00
Alexey Sokolov
da279f9622 Setup continuous testing on cygwin using AppVeyor 2015-05-04 10:17:58 +01:00
J-P Nurmi
75b210e841 Search'n'replace remaining NULL occurrences (#816) 2015-02-26 20:58:01 +01:00
Falk Seidel
2e29d49a53 Welcome to 2015 2014-12-31 11:28:38 +01:00
Uli Schlachter
74fdd97a52 CJob: Even cancel finished jobs
When a job was cancelled after its runThread() method finished, but before the
main thread noticed this and reacted, we would just run runMain() before and
pretend the job finished normally.

However, with CModuleJob this means that runMain() might get called for a module
which is currently being destructed. This has bad effects with virtual functions
and thus causes problems. It's better to just really cancel the job instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-11 09:09:38 +02:00
Uli Schlachter
1d67e87d90 CThreadPool: Add cancellation support
This adds CThreadPool::cancelJob() and cancelJobs() which can cancel a set of
jobs synchronously. These functions only return when the job was successfully
cancelled.

It tries to cancel the jobs as quickly as possible, skipping any callbacks on
CJob that were not yet called. A job that is already running can use
CJob::wasCancelled() to check if it should quit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06 15:15:57 +02:00
Uli Schlachter
0e057702db Add a ThreadTest to the testsuite
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06 14:50:59 +02:00