Commit Graph

998 Commits (195db1bad9697f75672838127ad435112ee72491)

Author SHA1 Message Date
lethosor a2f8742128 Merge remote-tracking branch 'suokko/runtime_debug_prints' into develop
Also fix and reorganize changelog
2018-12-27 16:28:25 -05:00
lethosor 13c6bfc1b2 Merge remote-tracking branch 'sgayda2/memory_fixes' into develop 2018-12-22 11:54:31 -05:00
Lethosor 9bd5ecd738
Merge pull request #1372 from BenLubar/dfhack-viewscreen-identity
Add an identity to dfhack_viewscreen and dfhack_lua_viewscreen.
2018-07-26 16:06:24 -04:00
Ben Lubar 4837e65322
Add an identity to dfhack_viewscreen and dfhack_lua_viewscreen. 2018-07-22 17:31:39 -05:00
Stoyan Gaydarov 38cccdb0f4 Update the module create calls to return unique_ptrs 2018-07-14 19:55:25 -07:00
Stoyan Gaydarov 6f90273bb6 More usage of smart pointers throughout core and version info. 2018-07-14 19:55:25 -07:00
Stoyan Gaydarov 6cfd987c0d Remove an outdated comment, with c++11 enabled the code is thread safe 2018-07-14 19:51:46 -07:00
Stoyan Gaydarov 12c8046f90 Some memory management changes for Core 2018-07-14 19:51:46 -07:00
Stoyan Gaydarov b5ddde8475 Use a shared_ptr to avoid having to manage VersionInfo vector memory 2018-07-14 19:51:46 -07:00
Stoyan Gaydarov c127ceab96 Use a unique_ptr for VersionInfo to avoid worrying about memory 2018-07-14 19:51:46 -07:00
Pauli bc8b8ef256 Use configure_file to optimize incremental builds for git-describe.h 2018-07-13 16:07:46 +03:00
lethosor 9ee368d456 Merge remote-tracking branch 'suokko/MapCache_reduce_latency_from_designation_to_jobs' into develop 2018-07-11 11:51:24 -04:00
lethosor 7afa3690bf Add support for DFHACK_BUILD_ID
Used for BuildMaster builds, for example
2018-07-11 11:47:55 -04:00
lethosor fa8c6724f6 Merge remote-tracking branch 'suokko/dlsym_libgraphics' into develop 2018-07-10 12:25:11 -04:00
lethosor 06511340ab Merge remote-tracking branch 'BenLubar/proto-docs' into develop 2018-07-10 11:26:31 -04:00
Pauli ca5c11603f Support dlsym loading from libgraphics vtables 2018-07-10 17:08:23 +03:00
lethosor 2dac3c53c7 Add stress cutoffs to Units module, fix dwarfmonitor/manipulator
Fixes #1292
2018-07-09 15:59:12 -04:00
lethosor 46e53fc3b3 Make df2console only call df2utf if the output stream is a console
Fixes output in command-prompt, for example
2018-07-09 11:00:28 -04:00
lethosor 03b01048d7 Merge remote-tracking branch 'BenLubar/linked-list' into develop 2018-07-07 23:49:53 -04:00
lethosor 037e7e4901 Merge remote-tracking branch 'suokko/spotclean_ui_state_fix_1194' into develop
Moved/adjusted changelog entry
2018-07-07 18:08:53 -04:00
lethosor aa76b92662 Merge remote-tracking branch 'suokko/main_thread_ownership_for_df_ai' into develop 2018-07-06 16:37:06 -04:00
Ben Lubar 3b6a0738a0
Add check-rpc.py for Travis. 2018-07-04 15:32:06 -05:00
Pauli d1a3f1a738 Allow canceling lineedit with ctrl+c 2018-07-04 15:21:25 +03:00
Pauli a550e112c3 Allow temporary transfer of main logic thread ownership
Dependency to fix df-ai to work with the new CoreSuspender
2018-07-04 00:02:03 +03:00
Ben Lubar dabe04cbf1
Rename bind argument proto -> plugin to avoid confusion. 2018-07-03 16:00:48 -05:00
Pauli 320e94a1eb Avoid locking CoreSuspender second time in main thread 2018-07-04 00:00:06 +03:00
Pauli ee999ccbdf Implement runtime debug print filtering
The runtime debug print filtering support dynamic debug print selection.
Tis patch only implements basic core support for filtering. The commands
to change the runtime filtering settings will be added in a following
patch.

But even with only this one can change filtering settings by editing
memory using a debugger. It can even be automated by using gdb break
point commands.
2018-07-03 15:23:46 +03:00
lethosor 616675f0ce Merge remote-tracking branch 'suokko/kittens_data_race_fix' into develop 2018-07-03 00:30:36 -04:00
lethosor c543a17250 Improve RPC port handling
- Use port from remote-server.json in dfhack-run
- Make DFHACK_RUN environment variable take priority over remote-server.json
- Log current port to stderr
2018-07-02 23:53:56 -04:00
lethosor 81a7ddcf92 Merge remote-tracking branch 'suokko/screen_show_memory_leak' into develop 2018-07-02 22:58:11 -04:00
lethosor f0ff96f614 Merge remote-tracking branch 'suokko/multibyte_console' into develop 2018-07-02 10:55:03 -04:00
Ben Lubar b5eb541fd3
Handle pointers back to the list link. 2018-06-30 23:04:27 -05:00
Ben Lubar 1606483e7e
perf improvement for DfLinkedList::end(), erase/insert/insert_after/push_front implementations 2018-06-30 23:04:26 -05:00
Ben Lubar 0b9d46712f
Run DfLinkedList::end's computations only when needed. 2018-06-30 23:04:26 -05:00
Ben Lubar 31d22967f8
Linked list 2018-06-30 23:04:26 -05:00
Pauli 645ec0d591 Improve kittens thread safety and shutdown with core
The bools could use acquire&release memory order or even relaxed but I
didn't think code was worth auditing for such low level optimizations.
Sequantial consistent is fast enough but much harder to use incorrectly.

The timeLast is protected by CoreSuspender lock. plugin_update is only
called when CoreSuspender lock is held.

The last_menu is protected by trackmenu_flg loads and stores.
2018-06-30 21:53:12 +03:00
Pauli 0727403ac1 Fix devel plugins linking in linux 2018-06-30 21:12:42 +03:00
lethosor 105ddd86d8 Merge remote-tracking branch 'suokko/jsoncpp_upgrade_to_submodule' into develop 2018-06-29 22:33:00 -04:00
Pauli c39a882b57 Add missing Unit::isDiplomat
Fixes #1324
2018-06-29 16:19:18 +03:00
Pauli 123de7fdf7 Use constexpr to prevent attempts of linking static variable 2018-06-24 17:06:32 +03:00
Pauli f6b0ac7819 Refactor CoreSuspender to fix Console::lineedit exit hangs
The old CoreSuspender requires processing from Core::Update to allow
commands execute. But that causes issues if Core::Shutdown wants
quarentee cleanup order with std:🧵:join. Fixing shutdown ordering
adds too many branches to already fairly complex code.

I decided to try to refactor CoreSuspender to use simpler locking
locking using a std::recusive_muted as primary synchronization
primitive.
To help control when Core::Update unlocks the primary mutex there is
std::contition_variable_any and std::atomic<size_t> queue lenght
counter.
The last state variable is std::atomic<std:🧵:id> that is used to
keep track of owner thread for Core::IsSuspended query.

This should be merged only just after a release to make sure that it
gets maximum testing in develop branch before next release.

Fixes #1066
2018-06-22 17:57:37 +03:00
Pauli 0bc1db4f07 Make sure hotkeythread exits before cleanup 2018-06-22 17:57:37 +03:00
Pauli 1acb60daa2 Prevent data races during console/init thread shutdown
There is a minor chance that console or init thread would access already
freed memory when core is shutting down and cleaning up state. To avoid
any danger of having random bugs caused by the potential data race I
decided to make sure the shutdown code waits for the thread to exit
first.

Windows change is completely untested. It is purely based on msdn
documentation.
2018-06-22 17:57:37 +03:00
Pauli 19a169ba65 Convert Core.cpp to use c++11 thread
I noticed that tthread is missing some c++11 features that make thread
handling code a bit easier. To be able to use those features I decided
to convert Core.cpp to use equivalent standard classes.

This patch has no functional changes.
2018-06-22 17:57:37 +03:00
lethosor 854f467f56 Merge remote-tracking branch 'suokko/check_jobs_on_mapcache_commit_1229' into develop 2018-06-21 15:03:51 -04:00
Pauli 9b6781f0f2 Temporary lower command-prompt when executing the command
command-prompt viewscreen may affect command execution if they are
looking for UI state. To make commands execute simillary to hotkeys or
console commands the viewscreen needs to removed from the top position.

Fixes #1194
2018-06-20 21:51:45 +03:00
lethosor 6077a8ce4c Merge remote-tracking branch 'suokko/printf_warnings' into develop 2018-06-20 11:25:14 -04:00
Pauli 9c59b7ff48 Fix unlikely memory leaks if Screen::show fails
The Screen::show takes ownership of the screen pointer. I decided to
switch the parameter to std::unique_ptr to make the pointer ownership
explicit. The unique_ptr then provides automatic screen destruction in
Screen::show unless pointer is inserted or is already in the linked list
that is managed by df.
2018-06-19 16:41:31 +03:00
Pauli 1b5ec7ce69 Update jobs when committing MapCache changes
The map_block->designation.{dig,smooth} are reset to zeros when a job
posting is created for the designation. The job is then used to override
the designation state in the map_block. To make the new designation set
propogate to jobs the job structure would require updating. The update
would be possible a complex operation. The simple alternative is to
remove the job and let df create a new job in the next tick.

Fixes #1229
2018-06-18 16:34:09 +03:00
Pauli 6a151353e3 Use automatic return type for index_tile 2018-06-18 16:23:57 +03:00