Search:

Type: Posts; User: justgotthis

Search: Search took 0.00 seconds.

  1. Replies
    7
    Views
    2,698

    Update: I run the program once and it runs just...

    Update: I run the program once and it runs just fine. The second time it loops around, it goes into the init() function but it doesn't generate the threads at all, then it exits as if everything...
  2. Replies
    7
    Views
    2,698

    headers

    Forgot to post the header files....however, I know that I have no issues with these. The header files work just fine. It is when I try to loop my programin the main while loop that the threads don't...
  3. Replies
    7
    Views
    2,698

    the sorting works, the output functions I...

    the sorting works, the output functions I removed, I will not output doubles, and yes my sorting does work without cluttering everything. I removed the double thread creations in the if statement as...
  4. Replies
    7
    Views
    2,698

    Anyone??? You don't even have to look at the...

    Anyone??? You don't even have to look at the entire code, I just need to know if it is possible ot create multiple threads in a while loop. I enter the while loop, create the threads which they...
  5. Replies
    7
    Views
    2,698

    threads

    The complete code is attached. When I free the memory, after one loop, everything starts all over again and initialize all the objects again. The first param in pthread_create is the id of the thread...
  6. Replies
    7
    Views
    2,698

    Multi-threading

    I created threads just fine. However, when I try to loop the main program and execute the threads and the functions anew all over again, the thread creation does not complete. It is weird because I...
  7. Thread: drand48

    by justgotthis
    Replies
    3
    Views
    25,117

    In my code snippet, I tried to seed the time so I...

    In my code snippet, I tried to seed the time so I can get random numbers everytime I run the program. I need to generate a random number from 0 to 1, but everytime I try to, I get a negative/positive...
  8. Thread: drand48

    by justgotthis
    Replies
    3
    Views
    25,117

    drand48

    I am trying to generate random numbers using drand48. I know, there are other random generators out there, but I need to use drand48. The code snippet is as follows:


    double seedrandUI()
    {...
  9. Thread: Semaphores

    by justgotthis
    Replies
    7
    Views
    4,834

    From the same code, I compile the program and it...

    From the same code, I compile the program and it gives me the error message:
    "semget IPC_CREAT: No space left on device". This is weird because I have more than enough space on my drive. What is the...
  10. Thread: Semaphores

    by justgotthis
    Replies
    7
    Views
    4,834

    well i just changed the int * from originally int...

    well i just changed the int * from originally int in the Init function because I was getting "invalid argument" when the init function gets called. I still get these messages without the pointer in...
  11. Thread: Semaphores

    by justgotthis
    Replies
    7
    Views
    4,834

    main

    I defined each by using #define. I have included my main file in the attachment.
  12. Thread: Semaphores

    by justgotthis
    Replies
    7
    Views
    4,834

    Semaphores

    I am trying to implement semaphores. The include file is as follows:



    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/ipc.h>
    #include <sys/sem.h>

    #define SEM_MODE 0666
  13. Thread: Conversion

    by justgotthis
    Replies
    4
    Views
    1,771

    sorry about that. out is the file descriptor and ...

    sorry about that. out is the file descriptor and arr is the array ptr being passed in.



    void theoutput(int* arr,int out)
    {
    int x;
    char convert[50]; //buffer to hold int
    for(x = 0; x <...
  14. Thread: Conversion

    by justgotthis
    Replies
    4
    Views
    1,771

    Conversion

    Hello, is there a way in C to convert an int to a char* (a string). I have done the following:

    sprintf(charptr,"%d",intvalue);

    But, when I run the program, an "H" appends to numbers that are...
Results 1 to 14 of 14