I would like to call pthread_join for a given thread id, but only if that thread has been started. The safe solution might be to add a variable to track which thread where started or not. However, I wonder if checking pthread_t variables is possible, something like the following code. Where some_invalid_value could be 0, or an implementation dependant ‘PTHREAD_INVALID_ID’
bash scripting: how to find the absolute path of “symlink/..”?
Given two files: Upon calling parent/scripts/hello.sh from any location, I would like (in the script) to find the full path of the parent directory. In this case parent. The main issue is that parent/scripts/.. refers to generic in unix. On the other hand, everything involving regexes is not generic and may be error prone. Solutions that don’t work: All these
OpenGL full screen texture brings framerate down to 12fps
I installed linux (Debian) on an old laptop and have been writing an OpenGL application with it. The framerate cruises at about 80fps when drawing a texture on a small portion of the screen. When I draw the texture on a bigger and bigger portion of the screen, the framerate drastically drops. A full-screen texture drops the fps to 12.
How to run process in terminal with reading only permission for given directory
I am trying to run a process in my terminal but I don’t trust the application that much. Is there is a way to run that application with just read permission from selected directory? I am using macOS. Answer As knittl told, you can use chroot for making jail. For the more complex things, MAC have MAC, (mean OS X
pthread – How to start running a new thread without calling join?
I want to start a new thread from the main thread. I can’t use join since I don’t want to wait for the thread to exit and than resume execution. Basically what I need is something like pthread_start(…), can’t find it though. Edit: As all of the answers suggested create_thread should start thread the problem is that in the simple
Is it possible to set pthread CPU affinity in OS X?
In Linux there is a sched_setaffinity() function defined in sched.h, but I can’t seem to find anything like that in Mac OS X 10.6 pthreads implementation… If it is not possible to set affinity, what is the default policy in OS X? Answer Mac OS X has Thread Affinity API and you can use it with pthread ID as thread_policy_set(pthread_mach_thread_np(pthreadId),
Change process name in Linux
I’m on Linux and I am forking/execing a new process out of my C spawn application. Is it possible to also change the naming of these new child processes? I want to be able to identify the process being started in case something goes wrong and I need to kill it manually. Currently they all have the same name. Answer
Is it possible to share a Cuda context between applications?
I’d like to pass a Cuda context between two independent Linux processes (using POSIX message queues, which I already have set up). Using cuCtxPopCurrent() and cuCtxPushCurrent(), I can get the context pointer, but this pointer is referenced in the memory of the process in which I call the function, and passing it between processes is meaningless. I’m looking for other
clear scrollback buffer of Linux Virtual Console Terminals
I’d like to clear the scrollback buffer on Linux console VTs programmatically. i.e. not just clear the current visible screen, but the entire scrollback buffer, too. I.e. everything that after a clear screen would still be visible with Alt-PgUp should be gone too. Anybody got an idea how to achieve that in nice code? Answer I don’t think this is
How to get formatted date time in python
I want my Linux Filename like this How can i get the date variable formatted like above in Python IN bash i write Answer You can use the same formatting string in strftime on a datetime object: Incidentally, I’d just like to put a word in for the joy of ISO-8601 date formatting