Changeset 88a6819 in mainline for uspace/srv/net/tcp/ncsim.c


Ignore:
Timestamp:
2012-05-08T08:18:48Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
99d05e1
Parents:
d21e935c
Message:

Use fibrils instead of threads for background work in TCP.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/ncsim.c

    rd21e935c r88a6819  
    4444#include <io/log.h>
    4545#include <stdlib.h>
    46 #include <thread.h>
     46#include <fibril.h>
    4747#include "conn.h"
    4848#include "ncsim.h"
     
    119119}
    120120
    121 /** Network condition simulator handler thread. */
    122 static void tcp_ncsim_thread(void *arg)
     121/** Network condition simulator handler fibril. */
     122static int tcp_ncsim_fibril(void *arg)
    123123{
    124124        link_t *link;
     
    126126        int rc;
    127127
    128         log_msg(LVL_DEBUG, "tcp_ncsim_thread()");
     128        log_msg(LVL_DEBUG, "tcp_ncsim_fibril()");
    129129
    130130
     
    151151                free(sqe);
    152152        }
     153
     154        /* Not reached */
     155        return 0;
    153156}
    154157
    155 /** Start simulator handler thread. */
    156 void tcp_ncsim_thread_start(void)
     158/** Start simulator handler fibril. */
     159void tcp_ncsim_fibril_start(void)
    157160{
    158         thread_id_t tid;
    159         int rc;
     161        fid_t fid;
    160162
    161         log_msg(LVL_DEBUG, "tcp_ncsim_thread_start()");
     163        log_msg(LVL_DEBUG, "tcp_ncsim_fibril_start()");
    162164
    163         rc = thread_create(tcp_ncsim_thread, NULL, "ncsim", &tid);
    164         if (rc != EOK) {
    165                 log_msg(LVL_ERROR, "Failed creating ncsim thread.");
     165        fid = fibril_create(tcp_ncsim_fibril, NULL);
     166        if (fid == 0) {
     167                log_msg(LVL_ERROR, "Failed creating ncsim fibril.");
    166168                return;
    167169        }
     170
     171        fibril_add_ready(fid);
    168172}
    169173
Note: See TracChangeset for help on using the changeset viewer.