My basic problem is that I'm having a hard time implementing a Pthread that consists of a round robin dequeuing 4 arrays consisting of ints. Followed by a Pthread that creates random numbers with which to enqueue them with. I've written most of the code for the queue itself and I've read up a lot on Pthreads, but I haven't found anything that explains it clearly. Here is my code for reference. [CODE=c]#include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <pthread.h> #define MaxQueueSize 10 #define FALSE 0 #define TRUE 1 typedef struct { int content[MaxQueueSize]; int head; …

Member Avatar
+0 forum 0

I got it to run but for some reason they incorrectly implemented the "chown" call. Here are some examples of how it is implemented in their test scripts: chown ${n0} 123 456 (where path is first) -u 65534 -g 65532,65531 -- chown ${n0} -1 65532 (where options are set before the actual call) (found from chown test script 00) I just don't get it. Originally I thought the test script would parse everything and set up the call properly after reading in the test line. However, when running the suite, every single chown test fails. I seem to be the …

Member Avatar
+0 forum 0

Hi, As part of porting a (mostly C++) library[1] to a "new" operating system[2], I'm trying to link the library's semaphore class to the platform's semaphore implementation. The problem is that the library assumes that the semaphore implementation will be a modern POSIX one[3] but the operating system's semaphores are modeled after System V[4]. My question is primarily if anyone knows of a wrapper of C (or C++) code that will act as an emulation layer around the System V semaphores in a way that will present "modern" POSIX semaphores to the library I'm porting. A caveat is that any …

Member Avatar
+0 forum 0

Hi all, Is there a way to make thread pools in POSIX pthreads? (using c) I could only find implementations for java and c++, but I need it to be in c. Thanks.

Member Avatar
Member Avatar
+0 forum 3

I found this great piece of code for validating URL's. I've been trying to get it to work with preg_match() since eregi() is deprecated with with PHP 5.3: [code=php]// SCHEME $urlregex = "^(https?|ftp)://"; // USER AND PASS (optional) $urlregex .= "([a-z0-9+!*(),;?&=$_.-]+(:[a-z0-9+!*(),;?&=$_.-]+)?@)?"; // HOSTNAME OR IP $urlregex .= "[a-z0-9+$_-]+(.[a-z0-9+$_-]+)*"; // http://x = allowed (ex. http://localhost, http://routerlogin) //$urlregex .= "[a-z0-9+$_-]+(.[a-z0-9+$_-]+)+"; // http://x.x = minimum //$urlregex .= "([a-z0-9+$_-]+.)*[a-z0-9+$_-]{2,3}"; // http://x.xx(x) = minimum //use only one of the above // PORT (optional) $urlregex .= "(:[0-9]{2,5})?"; // PATH (optional) $urlregex .= "(/([a-z0-9+$_-].?)+)*/?"; // GET Query (optional) $urlregex .= "(?[a-z+&$_.-][a-z0-9;:@/&%=+$_.-]*)?"; // ANCHOR (optional) $urlregex .= "(#[a-z_.-][a-z0-9+$_.-]*)?$"; …

Member Avatar
Member Avatar
+0 forum 2

Hello, I tried to compile a posix mq_send and mq_receive application. The msg is sent on the queue successfully, but during the receive part, an error occurs. I have attached the send and receive part of the code, please do suggest any corrections. mq_send [code=c] #include <mqueue.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <sys/stat.h> #define HI_PRIO 31 #define MSG_SIZE 16 //#define MSG "test" #define MQ_NAME "/msgqueue" int main(void) { mqd_t mqPXId; /* msg queue descriptor */ char *msg = "test"; /* open msg queue; should already exist with default attributes */ if ((mqPXId = mq_open (MQ_NAME, O_RDWR | O_CREAT, …

Member Avatar
Member Avatar
+0 forum 3

Hello everyone, I have installed Dev-C++ IDE on my system to run POSIX threads application. The program has compiled correctly. When I try to run the application, I am encountered with the following error Unable to locate component This application has failed to start because pthreadGC2.dll was not found. Re-installing the application may fix this problem. Any pointers guys? Thank you.

Member Avatar
Member Avatar
+0 forum 2

The End.