interprocess

take a screenshot and visually highlight the focused control

余生长醉 提交于 2019-12-08 06:49:35
问题 After happily using open source software for many years I've figured it's time to give back. And since documentation is usually a weak point for many projects, plus my C# skills are not exactly in high demand in my corner of FLOSS land, I've figured I'll start with tutorials, etc. After the second tutorial for a burning tool, I already got annoyed with the routine of take screenshot highlight any important part annotate it add to website repeat and figured I could automate that. I guess what

Linux inter-process reentrant semaphore

拟墨画扇 提交于 2019-12-08 05:40:24
问题 I'm porting a Windows application to Linux and I have a synchronization problem. In Windows I'm using a system-level named mutex to sync access to a shared memory block. How do I emulate that in Linux? I've created a SystemV semaphore, using semget. The problem is that it is not reentrant, if I already hold it it will block, unlike on Windows. I could add a reference count to it, but then I would need to synchronize access to that, which means another (this time for the current process only)

Boost interprocess Win32, x64

南笙酒味 提交于 2019-12-08 05:34:13
问题 I want to communicate between different platforms using boost interprocess. I am using vc12 and boost 1.58 on windows 7. My code below is a very simple example, that should work. But it doesn't for communications between diffrent platforms... If I create msm in x64 and open in win32, the process stuck at a lock at function try_based_lock in boost/int/sync/detail/common_algorithms.hpp In the other way around: win32 create, x64 open: the process crashes at name_length in segment_manager_helper

Why does boost's interprocess_condition deadlock in notify_one?

南笙酒味 提交于 2019-12-08 03:59:47
问题 This is a link to an MCVE that demonstrates the deadlock It contains five parts: SharedEvent is an implementation of an AutoResetEvent that is stored in shared memory. CreatedSharedEvent creates a named shared memory object in which a SharedEvent is allocated. It provides an accessor method that returns a reference to the SharedEvent. OpenedSharedEvent opens a named shared memory object in which a SharedEvent has already been allocated. It also provides an accessor method that returns a

enter pdb with kill signal

泄露秘密 提交于 2019-12-08 02:47:25
问题 In a recent project, I want to debug my program in production use state. The production environment is very complicated so I want to debug the program whenever I find a problem. This is what I want to achieve: whenever I want to debug, I will send a kill signal to the program and hopefully pdb debugger will appear. It is something like this: import pdb import signal import time def handler(signal, frame): pdb.set_trace() signal.signal(signal.SIGTERM, handler) a=1 while True: a+=1 time.sleep(1

Lock a file using windows c++ LockFIle() then get a stream from it?

北城余情 提交于 2019-12-07 20:01:53
问题 I have locked a file using LockFileEx , but I am not able to open a stream from it. HANDLE indexHandle = CreateFile (indexFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); bool indexLock = false; OVERLAPPED overlapped; memset (&overlapped, 0, sizeof (overlapped)); while (noOfTries >0 && !indexLock) { if (!LockFileEx (indexHandle, LOCKFILE_EXCLUSIVE_LOCK, 0, 0, UINT_MAX, &overlapped)) { InfoLog << "Failed to get lock on index file -- Error code

C#: Read and modify settings in another application's app.config file

柔情痞子 提交于 2019-12-07 18:29:42
问题 I have a number of applications running which communicate with each other but none of these applications have their own user interface. I have a system console application which acts as a user interface for the system (i.e. the set of applications which all talk to each other). I would like to be able to use the system console to read and modify the configuration of each of the non-gui apps. Each app has an app.config file created using the Visual Studio Settings GUI. The settings are all in

Is there an 'upgrade_to_unique_lock' for boost::interprocess?

守給你的承諾、 提交于 2019-12-07 10:39:07
问题 I am looking for the best way to effectively share chunks of data between two (or more) processes in a writer-biased reader/writer model. My current tests are with boost::interprocess . I have created some managed_shared_memory and am attempting to lock access to the data chunk by using an interprocess mutex stored in the shared memory. However, even when using sharable_lock on the reader and upgradable_lock on the writer, the client will read fragmented values during write operations instead

Is it possible to load a function into some allocated memory and run it from there?

徘徊边缘 提交于 2019-12-07 10:12:25
问题 I'm messing around with some interprocess communication stuff and I am curious if it's possible to copy a function into some shared memory and run it from there from either process. Something like: memcpy(shared_memory_address, &func, &func + sizeof(func)); I realize you can't take the size of the function but that was what popped into my head. 回答1: Theoretically, as functions are just sequence of byte code somewhere in the memory, you could copy the memory block of the function and call

Do I have to close inherited handle later owned by child process?

*爱你&永不变心* 提交于 2019-12-07 01:00:58
问题 Microsoft played safe here. In their article, "Creating a Child Process with Redirected Input and Output", they are saying: The remaining open handles are cleaned up when this process terminates. To avoid resource leaks in a larger application, close handles explicitly. Which is perfectly useless. What handles? In which process? I want to get my head around it. When a handle is created in parent process with SECURITY_ATTRIBUTES.bInheritHandle = TRUE , a child process can see and use it, and