Hi all,
I have two Python processes that need to communicate with each other on POSIX complaint system, as an IPC I thought that using a named pipe would be the easiest solution, however since I'm new with Python I suspect there are more options available. Anyone care to make a recommendation, besides a named pipe?
Thanks in advance,
...
I write cross-platform software, so I like my Windows environment to be Un*x-like (I'm an old Unix/IRIX/Linux geek). I just care about shells and tools, not so much about compilers or the build environment (I have a real industrial-strength build system that doesn't depend on mingw or cygwin). I just want a shell window on my Windows b...
Is there any way to obtain Unix Time with nanoseconds with strftime in bash?
My line for unix time :
<command> | awk '{ print strftime("%s"), $0; }'
I cannot use date +%N because date is only evaluated once.
Is there any work around?
...
The question is really simple: should a path to a directory always contain a slash at the end?
say: /path/to/directory/ over /path/to/directory.
Linux/Unix seem to accept both. Most applications and libraries on linux follow this. e.g. a <Directory /home/someproject/foo/code> works just fine.
In programming, say PHP I can do a dir on...
Following code is only to show how to use condition variable to synchronize threads(one producer and many consumers) as exercising.
See the line for code 'usleep(100);'.When I comment this line,two consumer threads seem got the mutex locked at the same time after the producer thread exit,and then wait on 'cond',this raise race condition...
I am a new bee to MAC/OSX. I am working on Titanium a cross platform runtime, which uses POCO library for most of the portable C++ API. I see that POCO uses POSIX semaphore for its NamedMutex implementation on OSX as opposed to SysV semaphore that it is using for few other *NIX.
bool NamedMutexImpl::tryLockImpl()
{
#if defined(sun) || ...
I have a multi-threaded application in a POSIX/Linux environment - I have no control over the code that creates the pthreads. At some point the process - owner of the pthreads - receives a signal.
The handler of that signal should abort,cancel or stop all the pthreads and log how many pthreads where running.
My problem is that I could ...
I have this requirement wherein I have to increment the value of a POSIX semaphore by more than 1.
Apparently, there is no way in POSIX specification to do this. There is no sem_setvalue() similar to sem_getvalue(). I do not want to go back to System V semaphores just because of this constraint.
Is there any alternative way to acco...
I'm trying to figure out how exactly to use stat() to capture information about a file. What I need is to be able to print several fields of information about a file. So..
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
using namespace std;
int main() {
struct stat buf;
stat("file",...
When should one use a semaphore and when should one use a conditional variable (CondVar) ?
...
The OS I'm working on (IBM CNK, which is not Linux, but somewhat POSIX-compliant) doesn't allow me to simply create a new file or directory in /dev/shm using fopen() or mkdir(), respectively. It looks like I have to use shm_open() to get a file descriptor and then fdopen() to use the shared region for file I/O.
Do I need to set the siz...
Hello,
I use POSIX threads on iPhone/iPad and when I try to destroy a mutex, pthread_mutex_destroy blocks in infinite loop. I did not find anything about this. It should return an error code...
Do you know something about this?
Thanks!
...
How do I receive layer 2 packets in POSIXy C++? The packets only have src and dst MAC address, type/length, and custom formatted data. They're not TCP or UDP or IP or IGMP or ARP or whatever - they're a home-brewed format given unto me by the Hardware guys.
My socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW) never returns from its recvfrom().
...
As the title says, how can I find a free block to be allocated at the highest virtual address using only the POSIX API?
...
is there any function in linux to display the value 7d162f7d in the format 125.22.47.125 ie convert the hexadecimal ip address in its standard ip format
...
Hi,
I am working on multithreaded code. Data access is locked in several sections via "NSLock" objects. I want to ensure that some methods which are called within these sections check if their appropriate lock was aquired.
Something like:
assert([myLock isSet] == YES);
I can't find something like "isSet" in NSLock. Any ideas how to ...
Hello,
I'm trying to understand some of the basics of using POSIX pthreads. The kind of thing I need to do (eventually) is parallelize some computations, using a thread pool model. At present I want to ensure I have a very basic sense for how the POSIX pthread model works. So I'm trying to create the simplest thread pool that's gen...
Hi,
Is there any way to monitor the performance of a thread on Android phone.
As in any POSIX library?
I want to find the time taken by a "thread" during execution, while many other applications might also be running.
Thank You.
...
Can someone explain why this code doesn't work as expected?
I would expect it only to match the first character, and it does with literal characters, but the wildcard (.) and characters classes behave strangely:
I use -o just to demonstrate exactly how things are matching, it doesn't change what matches at all.
$ echo foo | grep -o '^....
I used to think the second argument for inet_ntop should always be a struct in_addr or struct in6_addr. But then I looked up the POSIX definition:
const char *inet_ntop(int af, const void *restrict src,
char *restrict dst, socklen_t size);
[...] The src argument points to a buffer holding an IPv4 address if th...