From 3366fbde02d8d58bcc4469e61a9ae154b1e3a1df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 28 Nov 2004 23:20:24 +0000 Subject: [PATCH] names are based on system_time git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10280 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/unistd/pipe.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kernel/libroot/posix/unistd/pipe.c b/src/kernel/libroot/posix/unistd/pipe.c index 6d38b43cda..4c9f73edce 100644 --- a/src/kernel/libroot/posix/unistd/pipe.c +++ b/src/kernel/libroot/posix/unistd/pipe.c @@ -14,11 +14,13 @@ int pipe(int streams[2]) { - static int32 counter = 0; - // ToDo: a way without this variable would be even cooler - + bigtime_t timestamp = system_time(); char pipeName[64]; - sprintf(pipeName, "/pipe/%03lx-%03ld", find_thread(NULL), atomic_add(&counter, 1)); + + while (system_time() <= timestamp) // ensure we get an unused timestamp + ; + + sprintf(pipeName, "/pipe/%03lx-%Ld", find_thread(NULL), system_time()); streams[0] = open(pipeName, O_CREAT | O_RDONLY, 0777); if (streams[0] < 0)