Commit graph

24 commits

Author SHA1 Message Date
Arttu Ylä-Outinen bd8adff43a Drop unused defines in threads.h 2017-04-12 03:41:07 -07:00
Arttu Ylä-Outinen 7ab0a7aff2 Fix semaphores on Mac
POSIX semaphores are deprecated on Mac. This commit replaces POSIX
semaphores by Grand Central Dispatch semaphores when building on Mac.
2017-04-12 03:41:02 -07:00
Arttu Ylä-Outinen a5a925fc28 Replace timed waits by normal waits in threadqueue
Replaces calls to pthread_cond_timedwait with pthread_cond_wait in
threadqueue.c. Simplifies code, as there should be no need for the
timeout.
2017-02-11 15:42:03 +09:00
Ari Koivula d893474bab Fix encoder getting stuck on OS-X
Main thread was stuck looping on pthread_cond_timedwait because
the abs time given on OS-X had already passed and the wait
returned immediately without releasing the mutex to allow worker
threads to proceed.

Fix was to use the gettimeofday, which returns real time instead
of monotonic, which is what pthread_cond_timedwait wants.
2017-02-02 17:27:46 +02:00
Ari Koivula 4876879b82 Add IWYU pragmas 2016-03-31 12:33:34 +03:00
Marko Viitanen 41a5f9bbbe Fix filetime conversion to timespec 2016-03-24 10:08:11 +02:00
Ari Koivula 9139e169fe Fix unnecessary waiting in main thread
The main thread has to wait for the worker threads to finish. The
pthread_cond_timedwait call used to accomplish this was given
a relative instead of absolute time, which resulted in the call
returning immediately, because the time had already passed.

This removes the now unnecessary sleeps and fixes the time given to
the pthread_cond_timedwait such that it now waits until a job finishes
or 100ms have passed.
2016-03-23 22:23:04 +02:00
Ari Koivula 947bae24f9 Update Doxygen documentation
Add module information to all header files.

Update all header file documentations to briefly say what they are, and
to use the javadoc format so the brief actually gets included into the
doxygen documentation.

Remove \file from implementation files, in order to not repeat the info
from the header files.

Add files under strategies and tools to Doxygen and update the Doxygen
settings to be just plain better.

Make README be the main page of Doxygen documentation.
2015-12-17 14:05:50 +02:00
Ari Koivula 0722f461c5 Fix compiling tests on mac
The mac version of KVZ_GET_TIME macro has many statements, which
prevented it being used inside a for loop statement. Added brackets
to all versions to prevent this issue arising in the future.

Fixes #115.
2015-11-13 22:57:29 +02:00
Ari Koivula 93637f4683 Move macros in threads.h to KVZ_ namespace 2015-11-13 22:46:32 +02:00
darealshinji f51e3847b6 Fix cross-building on Linux 2015-11-06 21:53:44 +01:00
Ari Koivula d7383ccb25 Change license to LGPL.
- Everyone who has contributed code to the project has been asked to license
  their contributions under LPGL and they have agreed.

- COPYING file changed to say LGPLv2.1 instead of GPLv2.

- GPL changed to LGPL in the header of every single file that a header and
  header added to the few that were missing one.

- Also.. Happy new year!
2015-02-25 15:19:05 +02:00
Daniel Eneyev 27d79ffae3 workaround for GET_TIME in Mac OS 2015-01-13 17:06:55 +03:00
Ari Lemmetti 56c537e145 Build fixes for MinGW.
threads.h: use windows.h headers for clock stuff on MinGW
strategyselector.c: assert with strlen for MinGW support
2014-11-14 16:46:41 +02:00
Ari Koivula 04613bd5b3 Disable GET_TIME on Mac.
- This should fix the Mac version not compiling in issue #85.
2014-10-13 16:22:11 +03:00
Laurent Fasnacht f99e41d41f Improved CPU time statistics 2014-06-16 11:03:46 +02:00
Ari Koivula aa3549a717 Change SLEEP(0) to SLEEP(10) on Windows.
- This is a workaround for a performance problem on Windows where main thread
  is busy looping.
2014-06-13 12:01:03 +03:00
Ari Koivula 63f6cad5a0 Include global.h in thread modules. 2014-05-19 15:58:16 +03:00
Marko Viitanen 86155ef1ba Added windows specific timing macros for thread debugging 2014-05-16 12:16:22 +03:00
Laurent Fasnacht 36945e89ce Stubs to be able to make a portable version of the profiling 2014-05-16 10:15:05 +02:00
Ari Koivula 60a0ba4280 Update VS project files to link win32-pthread.
- I haven't found a good way of including external dependencies to VS projects
  yet. Win32-pthreads is assumed to be found at the same level as kvazaar dir
  and has the files x86/pthreadVC2.lib and x64/pthreadVC2.lib.

- Win32-pthreads also requires the pthreadVC2.dll to be in PATH when running
  the program. Not sure what to do about that yet. We might need an installer
  for windows to handle that.

- Disable openmp as it's no longer used.

- Stop linking Ws2_32.lib as that hasn't been used for ages.
2014-05-14 17:54:34 +03:00
Laurent Fasnacht 8b7774153f Add SLEEP() define 2014-05-14 13:27:08 +02:00
Marko Viitanen bf2c2a1330 Small changes to fix compiling on VS
- Added threads.h to VS project
- Included Windows.h in threads.h
2014-05-05 11:18:43 +03:00
Laurent Fasnacht 7f6f4fe9c1 Reference count for picture 2014-05-05 08:03:24 +02:00