Note that there are some explanatory texts on larger screens.

plurals
  1. POmalloc_consolidate Error while creating new Thread
    primarykey
    data
    text
    <p>I'm trying to create a program that manages simple threads. This is the main program:</p> <pre><code>int main(int argc, char **argv) { printf("test2:\n--------------\n"); clock_t stop1; uthread_init(100); printf ("***%d***\n",uthread_get_tid()); if(uthread_spawn(f1)==-1) printf("FAIL: uthread_spawn failure\n"); stop1 = clock () + 0.05 * CLOCKS_PER_SEC; int i; printf ("StartLoop of thread: ***%d***\n",uthread_get_tid()); while(clock ()&lt;stop1) { for(i=0;i&lt;10000000;i++) {} } printf ("FinishLoop of thread: ***%d***\n",uthread_get_tid()); uthread_terminate(0); return 0; } </code></pre> <p>The code is creating new Thread, which then creates a new thread, which then creats a new Thread. While creating the 3 third, I get the error. The program stucks here (In the creating thread function):</p> <pre><code>int uthread_spawn(void (*f)(void)) { DBG(("Spawning !")) //checking if number of threads is bigger then max if (getThreadCount() &gt; MAX_THREAD_NUM){ errmsgLibrary(MAX_THREADS_LIM); return FAIL; } // TODO - Check if needed to block/unblock here if (blockTimerSignal(BLOCK) == SUCCESS){ DBG(("Block signal success")) DBG(("ntid value: %d",nTid)) pThread t = new Thread(f,nTid++); DBG(("new thread created")) t-&gt;setState(Thread::READY); ready.push_back(t); DBG(("Added new Thread - %d",(nTid-1))) DBG(("Number of threads in ready list is - %d",(ready.size()))) blockTimerSignal(UNBLOCK); return (nTid-1); } DBG(("Block signal not success")) return FAIL; } </code></pre> <p>While trying to create new Thread().</p> <p>The error I get is:</p> <pre><code>test02-new: malloc.c:5161: malloc_consolidate: Assertion `p-&gt;fd_nextsize-&gt;bk_nextsize == p' failed. Abort </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload