Changeset 122 in libcf for trunk/test/socket.c


Ignore:
Timestamp:
06/12/13 11:05:07 (11 years ago)
Author:
cheese
Message:

#1 modify id to context in thread

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/socket.c

    r121 r122  
    135135    for (iter = 0 ; iter < THREAD_POOL ; iter++)
    136136    {
    137         if (CF_Thread_Create (&stid[iter], socket_echo_server, &sock) < 0)
     137        if (CF_Thread_CreateCtx (&stid[iter], socket_echo_server, &sock) < 0)
    138138        {
    139139            CF_DEBUG_PRINT (stderr, "failed to create %dth thread\n", iter);
     
    145145    for (iter = 0 ; iter < THREAD_POOL ; iter++)
    146146    {
    147         if (CF_Thread_Create (&ctid[iter], socket_echo_client, &sock) < 0)
     147        if (CF_Thread_CreateCtx (&ctid[iter], socket_echo_client, &sock) < 0)
    148148        {
    149149            CF_DEBUG_PRINT (stderr, "failed to create %dth thread\n", iter);
     
    155155    for (iter = 0 ; iter < THREAD_POOL ; iter++)
    156156    {
    157         CF_Thread_Join (&ctid[iter]);
    158         CF_Thread_DestroyCtx (&ctid[iter]);
     157        if (CF_Thread_Start (stid[iter]) < 0)
     158        {
     159            CF_DEBUG_PRINT (stderr, "failed to start %dth thread\n", iter);
     160            return -6;
     161        }
     162    }
    159163
    160         CF_Thread_Join (&stid[iter]);
    161         CF_Thread_DestroyCtx (&stid[iter]);
     164    for (iter = 0 ; iter < THREAD_POOL ; iter++)
     165    {
     166        if (CF_Thread_Start (ctid[iter]) < 0)
     167        {
     168            CF_DEBUG_PRINT (stderr, "failed to start %dth thread\n", iter);
     169            return -7;
     170        }
     171    }
     172
     173    for (iter = 0 ; iter < THREAD_POOL ; iter++)
     174    {
     175        CF_Thread_Join (ctid[iter]);
     176        CF_Thread_DestroyCtx (ctid[iter]);
     177
     178        CF_Thread_Join (stid[iter]);
     179        CF_Thread_DestroyCtx (stid[iter]);
    162180
    163181        CF_Log_Write (LOG_SOCKET, "SOCKET", "join server thread-%d\n", iter);
Note: See TracChangeset for help on using the changeset viewer.